Yes this looks like what I did after I wrote this question and it seems to be working well! Thanks!
Here’s the code snippet:
const getAccelerationVector = (
thrust: number,
thrustAngle: Quaternion,
mass: number
) => {
const vector = new Vector3(0, 1, 0).applyQuaternion(thrustAngle);
const scale = new Vector3(1, 1, 1).multiplyScalar(thrust / mass);
const addition = new Vector3(0, GRAVITY, 0);
const mult = new Vector3().multiplyVectors(vector, scale);
const final = mult.add(addition);
return final;
};
I think this is what you’re describing now.
What I’m sort of confused about though is how do I determine the proper initial vector? Here I’m using Vector3(0, 1, 0) because the y direction is “up”.
Also, I’m now trying to do this for angular rotation of all three axes because this rocket provides a thrust that can be angled which would impart a moment on the rocket in two of the rocket’s local axes.
So we know that for a single axis:
angularAcceleration = torque / momentOfInertia
and
torque = force * distance to center of gravity
And the force is the perpendicular force that can be found like:
force = totalForce * Math.cos(angle)
So that’s all well and good but when it comes to rotations in three dimensions, the force on an axis depends on a combination of two perpendicular components that come from the other two axes.
I have a quaternion which represents the rotation of the rocket body referenced to world space. And a quaternion that is made from euler angles to position the thrust I’m guessing in world space as well.
I’m not sure how to combine the rocket and thrust vectors to get the right forces.
In linear acceleration, I wanted all angles in world space because the acceleration is relative to the x,y and z axes of the world. But for rotation, I want the accelerations relative to rocket space because the rocket spins and it brings the rocket thruster along for the ride.