What's the right way to rotate an object around a point in three.js? : <p>Most tutorials/questions about three.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. Eg;</p>

<pre class="lang-js prettyprint-override"><code>//Make a pivot
var pivot = new THREE.Object3D();
//Make an object
var object = new THREE.Mesh( new THREE.BoxGeometry(2,2,2), new THREE.MeshBasicMaterial() );
//Add object to pivot
pivot.add(object);

//Move object away from pivot
object.position.set(new THREE.Vector3(5,0,0));

//rotate the object 90 degrees around pivot
pivot.rotation.y = Math.PI / 2;
</code></pre>

<p>This works but it's incredibly limiting - if you want to rotate an object around a different point you can't because an object can't have two parents.</p>

<p>The next method that works is applying a rotated matrix to the object's position, e.g.;</p>

<pre class="lang-js prettyprint-override"><code>//Make an object
var object = new THREE.Mesh( new THREE.BoxGeometry(2,2,2), new THREE.MeshBasicMaterial() );
//Move the object
object.position.set(new THREE.Vector3(5,0,0);

//Create a matrix
var matrix = new THREE.Matrix4();
//Rotate the matrix
matrix.makeRotationY(Math.PI / 2);

//rotate the object using the matrix
object.position.applyMatrix4(matrix);
</code></pre>

<p>Again, this works, but there doesn't appear to be a way to set the point of rotation. It's always the origin of the world. </p>

<p>Another option is a utility method in sceneUtils to detach a child from a parent object and another method to attach a new parent, but the documentation for that warns against using it, and it's never used in any example code.</p>

<p>Ultimately I want to be able to make a cube follow an S shaped path, but without this (seemingly) basic thing I'm finding it rather difficult.</p>

<p>tl;dr I want to rotate a three.js object around a series of different points. What would be a good way to approach that?</p>
