# Integrating angular damping into angular velocity and rotation

1. Sep 2, 2009

### cjcone311

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.

2. Sep 9, 2009

### LCKurtz

Lets say at t = 0 you want w = w_0 (using w for omega). You want to model this with exponential decay. Suppose w = w_0 exp(rt) so w = w_0 when t = 0.

Now at t = 1 you want w = .7 w_0 which gives

.7 w_0 = w_0 exp(r*1) so r = ln(.7).

Put that in to get your equation for w:

w = w_0 exp(t ln(.7)) = w_0 * (.7)^t

So you have an exponentially decaying w:

t = 0 w = w_0
t = 1 w = .7 w_0 (a decrease of 30%)
t = 2 w = .49 w_0 (another decrease of 30% from t = 1)

and so on.