Unity物体旋转的方法总结

    void Update()
    {
        float angle = Mathf.MoveTowardsAngle(transform.eulerAngles.y, target, speed * Time.deltaTime);
        transform.eulerAngles = new Vector3(0, angle, 0);
    }
    private void Update()
    {
        //transform.rotation = Quaternion.Slerp(A.rotation, B.rotation, Time.time * speed);
        transform.rotation = Quaternion.Lerp(A.rotation, B.rotation, Time.time * speed);
    }
    private void Update()
    {
		C.rotation = Quaternion.RotateTowards(A.rotation, B.rotation, Time.time * speed - 40f);
    }
  1. SLerp
  2. Quternion.AngleAxis
  3. Quternion.LookRation
  4. Transform.LookAt
  5. 加扭矩力
  6. RigidBody.MoveRotation
  7. Transform.Rotate
  8. Transform.RotateRound
  9. Quaternion.Inverse
  10. Quaternion.Dot(结果为1相同,-1多转了360度)
  11. B.rotation *= A.rotation;

你可能感兴趣的:(UnityScript)