Three.js - Rotating a object around certain axis

后端 未结 2 1807
自闭症患者
自闭症患者 2021-01-24 03:15

I\'ve used THREE={REVISION:\"68\"}

I\'ve already done rotation (OBJECT_X) by axis \"z\"http://jsfiddle.net/eVkgs/39/

When I change position OBJECT_X

2条回答
  •  不思量自难忘°
    2021-01-24 03:56

    An object will rotate around its origin in its local coordinate system. If you want to shift the origin, then you have to translate the geometry itself. Here is the pattern to follow:

    geometry.translate( dx, dy, dz );
    

    You can now create a mesh from the geometry, and set the mesh position:

    mesh.position.set( x, y, z );
    

    If you rotate the mesh, it will rotate around its new origin, and the mesh will be located at the point ( x, y, z ).

    three.js r.84

提交回复
热议问题