Page 1 of 1
Damping?
Posted: Thu Oct 30, 2008 2:37 pm
by juanpi
Hi,
I found this line surfing through cpSpaceState
Code: Select all
cpFloat damping = pow(1.0f/space->damping, -dt);
line 503 cpSpace.c
Is this doing (1/space->damping)^(-dt)? This is just (space->damping)^dt
The first equation produces error for really small damping (like free space), while the seconds does not. I guess there is a reason for doing this, right?
Thanks
Re: Damping?
Posted: Thu Oct 30, 2008 3:14 pm
by ker
correct me if I'm wrong, but the default value for cpSpace::damping is 1.0.
Therefore free space with no damping would have a damping value of 1.0 and 0.0 would be invalid.
This confused me at the beginning, too, since "no damping" would be 0.0 in my opinion and "full damping" 1.0.
Re: Damping?
Posted: Thu Oct 30, 2008 3:48 pm
by slembcke
Well, the thought was that you would be able to double the damping value to double the amount of damping. It is a bit confusing though.
Re: Damping?
Posted: Fri Oct 31, 2008 4:57 am
by ker
but e.g. 0.3 would be really strong damping, and doubling it would be 0.6 which would be a lot less damping in the current setup, or at least that is how it feels to me
Re: Damping?
Posted: Sun Nov 02, 2008 10:11 am
by juanpi
Sorry guy,
Yes, you are write that damping 1.0 is no damping. What was the range for damping in the original design? Is 1.0 < damping < \infty, where damping= 1.0 means no damping or was it 0 < damping < 1, where 1 is fully damped?
Anyway, what I was trying to point out is that
pow(1.0f/damping, -dt)
is the same as
pow(damping,dt)
but you save 2 operations.
Thanks!
Do not miss the new videos in youtube! Magnets!

Re: Damping?
Posted: Sun Nov 02, 2008 12:22 pm
by slembcke
/me smacks forehead
Right. I see where you were going with that now.