Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rotate a Three.js Vector3 around an axis?

How to rotate a Three.js Vector3 by a certain angle around an axis?

like image 719
MaiaVictor Avatar asked May 25 '12 01:05

MaiaVictor


People also ask

How do you rotate an object around a point in 3 JS?

js suggest the way to rotate an object around a point using three. js is to create a parent object at the position you want to rotate around, attach your object, and then move the child. Then when the parent is rotated the child rotates around the point.

What is vector3 in Threejs?

Class representing a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used to represent a number of things, such as: A point in 3D space.


1 Answers

var vector = new THREE.Vector3( 1, 0, 0 );  var axis = new THREE.Vector3( 0, 1, 0 ); var angle = Math.PI / 2;  vector.applyAxisAngle( axis, angle ); 
like image 138
mrdoob Avatar answered Sep 20 '22 21:09

mrdoob