请问大家们,为什么我这样进行物体移动时,前进是正常的,但是旋转起来很奇怪,在单独按ad键时,感觉旋转中心在物体的后方
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
public float moveSpeed = 10;
public float angularSpeed = 5;
public Rigidbody rb;
public GameObject Camera;
Vector3 v3 = new Vector3();
void Start()
{
rb = transform.GetComponent<Rigidbody>();
v3 = Camera.transform.position - transform.position;
}
void FixedUpdate()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
transform.Translate(horizontal * moveSpeed * Time.deltaTime, 0, vertical * angularSpeed * Time.deltaTime);
rb.velocity = transform.forward * vertical * moveSpeed;
rb.angularVelocity = transform.up * horizontal * angularSpeed;
Camera.transform.position = transform.position + v3;
}
}