简体   繁体   中英

Rotating an object on itself and around another central object in three.js

在three.js中,如何旋转对象本身以及围绕另一个中心对象?

Here an example in a Fiddle that shows how rotation works in three.js.

You can rotate an object around itself by changing the rotation:

object.rotation += 0.01;

You can rotate an object around its parent by adding it to the parent and rotating the parent:

parent.add( object );
parent.rotation += 0.01;

When you rotate the object itself after adding it to the parent, you will rotate it inside the local coordinate system (in this case the coordinate system of the parent).

Check also this answer that handles the rotation direction in three.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM