更新时间:2022-12-25 15:27:31
您需要使用四元数。 此视频说明了四元数以及它们在3D图形中的使用方式。
You need to use quaternions for this. This video explains what quaternions are and how they are used in 3D graphics.
你可以像这样构造一个四元数:
You can construct a quaternion like this:
quaternion = new THREE.Quaternion().setFromAxisAngle( axisOfRotation, angleOfRotation );
然后通过以下方式将其应用于您的对象:
Then you apply it to your object by:
object.rotation.setEulerFromQuaternion( quaternion );
您也可以使用对象层次结构来实现此目的。例如,您可以创建 Object3D()
实例并将其倾斜23.5 degs,然后创建一个球体(地球)并将其添加到倾斜对象。然后球体将围绕倾斜的Y轴旋转。然而,四元数是解决这个问题的***工具。
You can also achieve this by using object hierarchies. For example, you can make an Object3D()
instance and tilt it by 23.5 degs, then create a sphere (Earth) and add it to the tilted object. The sphere will then rotate around the tilted Y axis. Quaternions however, are the best tool for solving this.