JBCP
JBCP

Reputation: 13485

Direction of rotation or handedness in three.js

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.

Upvotes: 3

Views: 5607

Answers (1)

Wilt
Wilt

Reputation: 44366

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

source: https://en.wikipedia.org/wiki/Right-hand_rule

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

Upvotes: 15

Related Questions