When dealing with orbits, it's important to consider the axis involved. The point (0, 0, 0) in 3D space is just a lone point, so to establish an orbit, you would need to introduce another point, such as (-3, 8, 4), to create a normalized axis. In Three.js, utilizing an Object3D
allows for easy normalization of the objects.up
property. To demonstrate, consider this simple vector example:
var startPoint = new THREE.Vector3( 0, 0, 0 );
var axisVector = new THREE.Vector3( -3, 8, 4);
var endPoint = new THREE.Vector3( 300, 50, 200 );
var rotation = 0.05;
var axis = startPoint.clone().sub(axisVector).normalize();
endPoint.applyAxisAngle( axis, rotation );
For a more practical illustration, you can view a fiddle showcasing two cubes instead of basic Vector3
's here. I hope this explanation proves helpful!