要惯性旋转,不一定要控制他的rotatio,可以给他施加一个扭曲力torque
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour
{
private Vector3 torque;
private Rigidbody rigid;
private float x;
private float y;
void Start()
{
rigid = GetComponent<Rigidbody>();
}
void Update()
{
if (Input.GetMouseButton(0))
{
x = Input.GetAxis("Mouse X");
y = Input.GetAxis("Mouse Y");
torque = new Vector3(-y,-x,0);
rigid.AddTorque(torque); // 在扭曲力的作用下旋转
}
else
{
x = y = 0;
}
}
}
rigidbody组件中,angular Drag 是物体的角速度。角速度大的话,物体旋转的就会慢,因为路程很短。