Rotation in unity3d

I am a rookie who is getting started, I hope to record what I have learned like taking notes, and I also hope to help people who are also getting started.

Table of contents

1. Background knowledge

2. Some commonly used rotation angle representation methods and their meanings in unity3d

1. this.transform.rotation (attribute variable)

2、this.transform.eulerAngles

3、this.transform.localEulerAngles

4. Quaternion.identity (value type)

5、Quaternion.eulerAngles


1. Background knowledge

For details, see Euler angles, axis angles, quaternions and rotation matrices - ttya's blog - CSDN blog


2. Some commonly used rotation angle representation methods and their meanings in unity3d

1. this.transform.rotation (attribute variable)

It is used to store the rotation of the current object in the world space, which is a quaternion (not a degree, but a combination of sin and cos).

The rotation angle of transform.rotation is not fixed, and can be assigned after declaration.

2、this.transform.eulerAngles

Euler angles of the object relative to world coordinates

3、this.transform.localEulerAngles

Euler angles of the object relative to the parent object

4. Quaternion.identity (value type)

No rotation - ie equivalent to Quaternion(0,0,0,0)

Note: read-only: the rotation angle of Quaternion.identity is fixed, and cannot be reassigned after declaration

5、Quaternion.eulerAngles

Convert Euler angles to quaternion format and save


Everyone is welcome to criticize and correct in the comment area, thank you~

Guess you like

Origin blog.csdn.net/weixin_55073640/article/details/125768476