- #1
cjcone311
- 1
- 0
I'm using a 3rd party physics engine to run rigid body physics. It just updates the bodies once every 16 ms or so. I'm trying to write an algorithm to predict where free-falling bodies will be in 2 seconds using standard physics equations. I'm having trouble with predicting angular velocity and rotation though.
I know the physics engine calculates angular velocity by subtracting 30% velocity/second from the current velocity. If I calculate the angular velocity at t=1 and at t=2, the angular velocity at t=2 is 30% of that at t=1.
I've confirmed that with the physics engine, every frame that is run, the change in angular velocity over the change in time is always 30%.
However, if I try to predict ahead of the object with some time t, using the equation:
NewSpeed = OldSpeed - ( OldSpeed * Damping * t )
the predicted angular velocity loss begins to differ from the real angular velocity loss as t gets larger.
For instance, if I predict the angular velocity at t1=0.1 and t2=0.2 and compare the difference over t2 - t1, the angular velocity loss is about 30%, as it should be.
However, at t1=1.9 and t2=2.0, the difference over t2 - t1 shows an angular velocity loss of about 45%, way more than it should have been.
So, my equation:
NewSpeed = OldSpeed - ( OldSpeed * Damping * t)
Seems to be wrong. I'm wondering if there's some calculus magic that could give me a better equation, with the knowledge that angular velocity is constantly decreasing by 30%.
Thanks for any help - if this gets solved, I'll have a part 2 for my question on how to calculate the current rotation given an initial rotation, initial angular velocity, and angular damping.
I know the physics engine calculates angular velocity by subtracting 30% velocity/second from the current velocity. If I calculate the angular velocity at t=1 and at t=2, the angular velocity at t=2 is 30% of that at t=1.
I've confirmed that with the physics engine, every frame that is run, the change in angular velocity over the change in time is always 30%.
However, if I try to predict ahead of the object with some time t, using the equation:
NewSpeed = OldSpeed - ( OldSpeed * Damping * t )
the predicted angular velocity loss begins to differ from the real angular velocity loss as t gets larger.
For instance, if I predict the angular velocity at t1=0.1 and t2=0.2 and compare the difference over t2 - t1, the angular velocity loss is about 30%, as it should be.
However, at t1=1.9 and t2=2.0, the difference over t2 - t1 shows an angular velocity loss of about 45%, way more than it should have been.
So, my equation:
NewSpeed = OldSpeed - ( OldSpeed * Damping * t)
Seems to be wrong. I'm wondering if there's some calculus magic that could give me a better equation, with the knowledge that angular velocity is constantly decreasing by 30%.
Thanks for any help - if this gets solved, I'll have a part 2 for my question on how to calculate the current rotation given an initial rotation, initial angular velocity, and angular damping.