The difference between transform. Rotate and transform. rotatearound in Unity 3D

Source: Internet
Author: User

Transform. Rotate Rotation

Apply the Rotation Angle of an ouarla angle. The eulerangles. Z degree is centered around the Z axis, the eulerangles. x degree is centered around the X axis, and the eulerangles. y degree is centered around the Y axis (in this Order ).

If the rotation angle is left blank or set to space. self, it is applied to its own axis around the transformation. (X, Y, and Z axes are displayed when an object is selected in the scenario view.) If the rotation angle relative to space. World is applied to the X, Y, and Z axes around the world.

 

1Gameobject. Transform. Rotate (NewVector3 (0,1,0), Input. getaxis ("Horizontal"); // Indicates to press the left and right keys to rotate around the Y axis. The rotation method is as follows:

 

It can be seen that there is a certain distance between the rotation center and the rotating orbit. Just like the Earth's revolution around the sun.

 

 

 

Transform. rotatearound rotates around

Rotate an object by angle through the point axis in the world coordinates.

Simply put, an object is rotated at a certain position in the world coordinate based on its degree.

Gameobject. Transform. rotatearound (NewVector3 (0,0,0),NewVector3 (0,1.0f,0), Speed * time. deltatime * input. getaxis ("Horizontal"); // Indicates that the left and right moving keys are pressed, and the object rotates around the Y axis at the specified point. The rotation method is as follows:

Just like the autobiography of the Earth.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.