Skip to content

Representing angular velocity via a quaternion could be problematic #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
smcameron opened this issue Sep 24, 2021 · 0 comments
Open

Comments

@smcameron
Copy link
Owner

smcameron commented Sep 24, 2021

But quaternions is what we use for angular velocity throughout SNIS. Not that I've noticed any problems with it in SNIS, however.

But... it can only represent angular velocities less than 360 degrees per time step. Also, it only works with a fixed timestep.

The "correct" and "conventional" way to represent angular velocities is via a vec3 pointing along the axis of rotation (similar to how a quaternion is constructed), with magnitude equal to the magnitude of the angular velocity (in whatever units... degrees per second, or whatever.) This accomodates a variable timestep and allows for arbitrarily large angular velocities.

This stackoverflow question goes into it in some depth:
https://stackoverflow.com/questions/24197182/efficient-quaternion-angular-velocity

We would also save a float's worth of bandwidth for each angular velocity transmitted over the network.

All that being said... given that the "physics", such as it is in SNIS, is so lackadaisical, the only problem one might "see" in SNIS is that the timesteps are not necessarily precisely equal from one frame to the next, and this is not taken into account by the current way of using quaternions for angular velocity. So, maybe if you very carefully measured rotating asteroids, you might see them very very slightly speed up or slow down in their rotations. So this is more of a theoretical problem than an actual problem in the game as it stands today.

Also, if something were rotating very very fast, it might exceed the rotation representable by a quaternion for the selected timestep (unlikely).

So... this bug report is kind of like a... "D'oh! I did it wrong! (but my way still works well enough that I haven't noticed any problem since 2013.)"

And I didn't find out about this by spotting a problem, I suggested to someone else that they should use a quaternion to represent angular velocity, and someone else pointed out that this wasn't a very good idea for several reasons.

So, fixing this would be quite a lot of work, for next to no perceivable benefit. But... it's kind of bothering me, so maybe if I get really bored...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant