Page 1 of 1

[SOLVED]Linear & Angular Damping For Multiple Axes/Rotations

Posted: Wed Nov 16, 2016 8:44 pm
by lassytouton
Hi,

Bullet's btRigidBody::setDamping function takes two scalars... the first specifying a linear damping coefficient and the second specifying an angular damping coefficient.
There is a single linear damping coefficient for each of the axes (surge, sway, heave) and a single angular damping coefficient for each of the rotations (yaw, pitch, roll)

Is there a method that enables one to specify separate linear damping coefficients for surge, sway, heave (body coordinate frame) and separate angular damping coefficients for yaw, pitch, roll (body coordinate frame)?

If there is no such method would it be ok to multiply the linear velocity by the surge, sway, and heave damping coefficients and the angular velocity (body coordinate frame) by the yaw, pitch, and roll damping coefficients?

For example

*** sway is along x axis, heave is along y axis, and surge is along z axis (y axis points up)
linear_damping_vector = ((1.0 - sway_damping) ^ timeStep, (1.0 - heave_damping) ^ timeStep, (1.0 - surge_damping) ^ timeStep)

linear_velocity *= linear_damping_vector


angular_damping_vector * = ((1.0 - pitch_damping) ^ timeStep, (1.0 - yaw_damping) ^ timeStep, (1.0 - roll_damping) ^ timeStep)

angular_damping = center_of_mass_transform * (inverse center_of_mass_transform * angular_velocity) * angular_damping_vector - center_of_mass_transform_origin


Thanks

Re: Linear And Angular Damping For Multiple Axes / Rotations

Posted: Thu Nov 17, 2016 10:31 pm
by benelot
I think there is no such damping method for separate axes, but you can easily multiply your damping into your velocities. Be sure to use a callback to apply the damping in a systematic fashion at every bullet step.

Re: Linear And Angular Damping For Multiple Axes / Rotations

Posted: Wed Nov 23, 2016 1:27 am
by lassytouton
Thanks benelot,


As per your suggestion I wrote an InternalTickCallback function in which I multiplied the linear and angular velocities by my corresponding damping cofficients... things appear to be working well.


Cheers