且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Three.js 中的旋转方向或惯用手

更新时间:2023-10-28 22:45:16

Three.js 使用

左手系(顺时针),右手系(逆时针)

然后添加一些东西到你的角度逆时针旋转取下东西顺时针旋转.

函数旋转(){mesh1.rotation.z += 0.01;//逆时针旋转mesh2.rotation.z -= 0.01;//顺时针旋转}

此处演示的小提琴

I've noticed that when I rotate my model around the Z axis, like this:

model.rotateZ(rotatedAngle * Math.PI / 180);

it seems to rotate counter-clockwise around the axis.

  • Is this observation accurate?
  • Is this documented somewhere? I couldn't find it, perhaps I'm using the wrong search terms.
  • Is this configurable?
  • Most importantly what is the best practice for managing rotations?

Three.js uses the right handed system and this means counter clockwise is default rotation. See here for all rotation rules...

Left the left handed system (clockwise), right the right handed system (counter clockwise)

So then adding something to your angle rotates counter clockwise and removing something rotates clockwise.

function rotate(){
    mesh1.rotation.z += 0.01;  // rotates counter clockwise
    mesh2.rotation.z -= 0.01;  // rotates clockwise
}

A Fiddle here to demonstrate