Skip to content Skip to sidebar Skip to footer

Three.js: Can You Force A Different Order Of Operations For Three.js?

See this question: Threejs Transform Matrix ordering I'm drawing the orbits of the planets and having problems with changing inertial reference frames (I chose to align the three.j

Solution 1:

Okay. I just posted this, but found the solution for anyone who has the same problem in the future. If you want to apply things in a different order of operations than three.js wants you to (as seen in this post: Threejs Transform Matrix ordering). Then you must use the applyMatrix function between each operation that you wish to do in a specific order.

Using the above as an example:

ellipse.position.set(0,0,0);
ellipse.rotation.set(0,0,0);
ellipse.updateMatrix();

ellipse.applyMatrix(DCM);
ellipse.updateMatrix();

ellipse.translateX(r.x);
ellipse.translateY(r.y);
ellipse.translateZ(r.z);
ellipse.updateMatrix();

ellipse.rotateZ(RAAN); // RAAN : right angle of ascending node
ellipse.rotateX(inc);  // inc  : orbit inclination
ellipse.rotateZ(ArgP); // ArgP : Argument of Periapsis.
ellipse.updateMatrix();

ellipse.translateX(-c);
ellipse.updateMatrix();

Post a Comment for "Three.js: Can You Force A Different Order Of Operations For Three.js?"