Rotation problems with .makeRotationAxis()

hello noob here :slight_smile:
i have a position (var position) I want to around an arbitrary axis (var axis) and after that I get the position and I used for something else

I have this code :

var rotationMatrix = new THREE.Matrix4();
var position = new THREE.Vector3(43,9,0);
var angle=Math.PI;
var axis = new THREE.Vector3(0,0,0);
rotationMatrix.makeRotationAxis( axis, angle );


object.position.x = position.x;
object.position.y = position.y;
object.position.z = position.z;

only the angle PI work fo the other i receive weird values for my position-Vector

You must have atleast one direction specified.
Try using :

var axis = new THREE.Vector3(1,0,0)  // for x - axis
var axis = new THREE.Vector3(0,1,0)  // for y - axis
var axis = new THREE.Vector3(0,0,1)  // for z - axis
1 Like

Thanks for the help.

BTW: It can be an arbitrary axis (not necessarily x/y/z axis). It’s just important that the vector is normalized and not (0,0,0).