【发布时间】:2017-04-04 04:09:37
【问题描述】:
我的问题是当我实例化一个游戏对象时,它应该像我的播放器一样翻转 但是当我左转时它只是在翻转。
using UnityEngine;
using System.Collections;
public class beam : MonoBehaviour {
public Transform firePoint;
public move dino;
void Awake()
{
dino = GetComponent<move>();
dino = FindObjectOfType<move>();
firePoint = GameObject.FindGameObjectWithTag("spawn").transform;
}
// Use this for initialization
void Start () {
}
void FixedUpdate ()
{
transform.position = firePoint.position;
}
void Update ()
{
if (dino.GetComponent<move>().facingRight == false)
{
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}
}
例如:我的播放器面向右侧,“Beam”也面向右侧,但是当我的播放器面向左侧时,“Beam”在-1 和 +1 之间切换
我希望你明白我的意思。请帮忙:)
【问题讨论】:
-
是精灵吗?还是 3d?
-
它是一个精灵。