无法让 Vector3.right 与 transform.Rotate 统一工作
Cant get Vector3.right to work with transform.Rotate in unity
我正在尝试让我的相机围绕分配给它的游戏对象旋转。到目前为止,我可以让它围绕游戏对象旋转,但它是向左旋转而不是向右旋转。任何帮助表示赞赏。这是我的代码。
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class CameraRotate : MonoBehaviour
{
public float speed;
float time = 5.0f;
public bool updateOn = true;
void Start()
{
StartCoroutine(updateOff());
}
void Update()
{
if (updateOn == true)
{
if (time >= 0)
{
time -= Time.deltaTime;
return;
}
else
{
transform.Rotate(0, speed * Time.deltaTime, 0);
}
}
}
IEnumerator updateOff()
{
yield return new WaitForSeconds(10.0f);
updateOn = false;
}
}
using UnityEngine;
using System.Collections;
public class CameraRotate : MonoBehaviour
{
public float speed;
float time = 5.0f;
public bool updateOn = true;
void Start()
{
StartCoroutine(updateOff());
}
void Update()
{
if (updateOn == true)
{
if (time >= 0)
{
time -= Time.deltaTime;
return;
}
else
{
transform.Rotate(0, -speed * Time.deltaTime, 0);
}
}
}
IEnumerator updateOff()
{
yield return new WaitForSeconds(10.0f);
updateOn = false;
}
}
我正在尝试让我的相机围绕分配给它的游戏对象旋转。到目前为止,我可以让它围绕游戏对象旋转,但它是向左旋转而不是向右旋转。任何帮助表示赞赏。这是我的代码。
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class CameraRotate : MonoBehaviour
{
public float speed;
float time = 5.0f;
public bool updateOn = true;
void Start()
{
StartCoroutine(updateOff());
}
void Update()
{
if (updateOn == true)
{
if (time >= 0)
{
time -= Time.deltaTime;
return;
}
else
{
transform.Rotate(0, speed * Time.deltaTime, 0);
}
}
}
IEnumerator updateOff()
{
yield return new WaitForSeconds(10.0f);
updateOn = false;
}
}
using UnityEngine;
using System.Collections;
public class CameraRotate : MonoBehaviour
{
public float speed;
float time = 5.0f;
public bool updateOn = true;
void Start()
{
StartCoroutine(updateOff());
}
void Update()
{
if (updateOn == true)
{
if (time >= 0)
{
time -= Time.deltaTime;
return;
}
else
{
transform.Rotate(0, -speed * Time.deltaTime, 0);
}
}
}
IEnumerator updateOff()
{
yield return new WaitForSeconds(10.0f);
updateOn = false;
}
}