If I have to rotate objects around a pivot point, i follow the following steps:
- make a list of objects to rotate
- create a pivot point
- Attach pivot to object
- rotate pivot by 90 degrees
- ?? Do I need to updateMatrixWorld here? or mutiply the pivot world matrix to object position? (To update the position of the object?)
- add the objects back to the scene
- delete pivot point
var listofObject = [object1, object2];
var pivot = new THREE.Object3D();
pivot.position.set(0,0,0);
pivot.rotation.set(0,0,0);
for(var i = 0; i < listOfObject.length; i++)
{
pivot.attach(listofObject[i];
}
//rotate the pivot
pivot.rotation.x = Math.PI / 2;
// I believe i need to update the position of the objects? here how do i do it?
//then add the object back to the scene
If we were to multiply the position of the object with the pivot world matrix ( which is, i believe, a transformational matrix with only rotation values ) wouldn’t that mess up the position values of the object? ( wounldn’t it return some weird position values? )
Also are any kind of values having “e” in them are normal? cause i get some of those values
Can you point me towards some resources where i can learn more about this?
EDIT: I think i have understood, how everything works and i have successfully solved the issue. The problem was i was using the applyMatrix4() for the wrong object parameter