发布网友 发布时间:2022-05-02 20:48
共2个回答
热心网友 时间:2023-10-09 11:58
这个可能是模型坐标变化引起的热心网友 时间:2023-10-09 11:58
public float moveSpeed = 2f;public float rotateSpeed = 2f; void Update (){float h = Input.GetAxis("Horizontal");float v = Input.GetAxis("Vertical");if (h != 0 || v != 0){Vector3 targetDirection = new Vector3(h, 0, v);float y = Camera.main.transform.rotation.eulerAngles.y;targetDirection = Quaternion.Euler(0, y, 0) * targetDirection; transform.Translate(targetDirection * Time.deltaTime * moveSpeed,Space.World);