After constructing my 3D globe and placing it within a parent bounding box / pivot, the code looked like this:
var globe = new THREE.Group();
if (earthmesh) {globe.add(earthmesh);};
if (linesmesh) {globe.add(linesmesh);};
if (cloudmesh) {globe.add(cloudmesh);};
if (atmosmesh) {globe.add(atmosmesh);};
pivot = new THREE.Group();
if (globe) {pivot.add(globe);};
if (pivot) {scene.add(pivot);};
As a result, when applying a 23 degree rotation around the Z axis on the parent:
pivot.rotation.set(THREE.Math.degToRad(0), THREE.Math.degToRad(0), THREE.Math.degToRad(23));
The globe would rotate around the Y axis relative to its parent in the animation function. This function utilizes an object 'v' with properties for looping, rotation speed, as well as X, Y, and Z rotations:
function animate()
{
delta = clock.getDelta();
resize();
v.spin = (v.loop + v.spin + v.rate * delta) % v.loop;
globe.rotation.set(THREE.Math.degToRad(v.roll), THREE.Math.degToRad(v.spin), THREE.Math.degToRad(v.tilt));
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
This method of rotation provides the desired effect shown by the green arrow in the illustration.
To achieve similar object rotation within its parent without explicitly setting the parent-child relationship, I seek alternative tools available in Three.js such as matrices, vectors, or quaternions. How can this be accomplished?
In addition, transitioning between the "normal" and "altered" rotation systems should be straightforward without needing to reconstruct the parent-child setup. Full rotation control on all axes is also essential.
If reverting to the original rotation system becomes necessary, what specific rotation would need to be applied to the globe child to maintain its visual orientation?
Note: Assumptions are made regarding the position and rotation of both parent and child groups for simplicity and clarity of the question.
P.S. Suggestions for improving the clarity and conciseness of the question are welcome, but please refrain from prematurely marking it as duplicate or closing it before thoroughly considering the context.