It seems impossible to model angular momentum using Euler angles.
See original GitHub issueHi there. I tried to start a discussion in the forum, but my post was auto-flagged (as spam), and hasn’t been cleared (I’m a new user there), so I wasn’t able to find out more before posting here. I’ve probably misunderstood something (I’m pretty new to 3D graphics), but it seems impossible to (directly) rotate objects in Three.js, based on angular momentum, as the Euler
objects used to represent orientation will (no matter which order they use) always rotate around one axis in worldspace.
Imagine a first-person space game with basic Newtonian motion. The camera/ship should just drift (and rotate) through space, until some force is applied etc. The following (simplified) example doesn’t work (in Three.js), as camera.rotation
is an Euler
instance:
const [velocity, momentum] = [new Vector3(), new Vector3()];
const update = function() {
camera.position.add(velocity);
camera.rotation.add(momentum); // this is invalid
};
I can use rotateX
, rotateY
and rotateZ
to add each component of momentum
separately, but have read that that is deprecated, and I should use Euler angles instead. That doesn’t seem possible here, as I need everything to be local (relative to the camera), and rotation using Euler angles always implies one non-local axis (if I understand correctly, which isn’t especially likely).
I’d be grateful if somebody could help me figure out what I’m missing. I just need a pointer really. I’m happy to do the homework myself. What am I not getting?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I’ve raised your trust level by 1. Hope everything works as expected now.
@Mugen87 - Thank you. The forum post seems to be lost, but I was able to figure it out (thanks to @LeviPesin’s comment) anyway, so it’s no problem. My issue is fixed, and the forum is working. Thanks again, guys.