标签:space getdir set 坐标系 fse 坐标 put class ica
void Update () {
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
if (Input.GetKey(KeyCode.J))
{
transform.Rotate(-Vector3.up * Time.deltaTime * 50f, Space.World);
}
if (h != 0 || v != 0)
{
Vector3 targetOffset = new Vector3(h, 0, v);
float y = transform.rotation.eulerAngles.y;
Vector3 targetDirection = Quaternion.Euler(0, y, 0) * targetOffset;
transform.Translate(targetDirection * Time.deltaTime * 50, Space.World);
}
}
标签:space getdir set 坐标系 fse 坐标 put class ica
原文地址:https://www.cnblogs.com/fagex/p/9289092.html