According to docs/code, damping in Bullet is value in range 0-1 which means fraction of velocity lost per second.
Since value of damping can't be higher that 1, that means it takes at least one second for rigid-body to stop (with no any forces/torques applied).
But what if I need to stop rigid-body faster?
Question about damping
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Question about damping
apply the force/torque backwards? or more straightforward setLinearVelocity/setAngularVelocity ?
This is the simplest way I can come up with.
Cheers
This is the simplest way I can come up with.
Cheers
-
- Posts: 8
- Joined: Fri Sep 03, 2010 9:03 am
Re: Question about damping
Well, applying additional force/torque may cause movement in opposite direction, and tweaking that will be a bit complicated (compared to tweaking single number of damping).Dr.Shepherd wrote:apply the force/torque backwards? or more straightforward setLinearVelocity/setAngularVelocity ?
What I really need is ability to specify damping as "time amount needed for rigid-body to stop motion completely (in absence of applied forces/torques)", it's more intuitive IMO. Looks like I just have to implement such version of damping.
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Question about damping
If you don't take an object's current velocity into account, how would you produce an intuitive result? Ie stating that an object should come to rest after 1 second, regardless of whether it's traveling 0.1m/s or 10000m/s, doesn't seem like it would give an intuitive result. But obviously if you do need something like this for your own purposes anyway, then you can of course implement it.
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Question about damping
Yeah, setting the velocity directly to 0 would result in a sudden stop. I don't know if there is existing methods to stop it continuously to zero.
Force and torque is a bit tricky, I guess, perhaps we should develop some function to do this continuous stop.
Force and torque is a bit tricky, I guess, perhaps we should develop some function to do this continuous stop.
-
- Posts: 8
- Joined: Fri Sep 03, 2010 9:03 am
Re: Question about damping
Well, I won't argue that my 'definition' of damping is more intuitive (or it's even need to work that way).dphil wrote:If you don't take an object's current velocity into account, how would you produce an intuitive result? Ie stating that an object should come to rest after 1 second, regardless of whether it's traveling 0.1m/s or 10000m/s, doesn't seem like it would give an intuitive result. But obviously if you do need something like this for your own purposes anyway, then you can of course implement it.
I just need (in certain cases) linear/angular velocity to be damped 'harder' than it does with damping set to 0.999 in current Bullet implementation.
for example doing
Code: Select all
m_angularVelocity *= k * btPow(btScalar(1)-m_angularDamping, timeStep);
Perhaps I should just add some 'extra-damping-scale' parameter to my rigid-body and set it to 1.0f by default.
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Question about damping
Yes, that's a simple solution to re-implement the damping method. Straightforward and efficient !BLK Dragon wrote:Well, I won't argue that my 'definition' of damping is more intuitive (or it's even need to work that way).dphil wrote:If you don't take an object's current velocity into account, how would you produce an intuitive result? Ie stating that an object should come to rest after 1 second, regardless of whether it's traveling 0.1m/s or 10000m/s, doesn't seem like it would give an intuitive result. But obviously if you do need something like this for your own purposes anyway, then you can of course implement it.
I just need (in certain cases) linear/angular velocity to be damped 'harder' than it does with damping set to 0.999 in current Bullet implementation.
for example doingin btRigidBody::applyDamping (with k hardcoded to 0.2 for quick-test) gives exactly what I want -- with large enough torque movement starts fast and stops fast;Code: Select all
m_angularVelocity *= k * btPow(btScalar(1)-m_angularDamping, timeStep);
Perhaps I should just add some 'extra-damping-scale' parameter to my rigid-body and set it to 1.0f by default.