add impact

This commit is contained in:
Dave Schuyler 2006-03-09 22:52:35 +00:00
parent 294cc53817
commit 18cc3f1b0f
1 changed files with 23 additions and 0 deletions

View File

@ -91,6 +91,29 @@ make_copy() const {
return new PhysicsObject(*this);
}
////////////////////////////////////////////////////////////////////
// Function : add_impact
// Access : Public
// Description : Adds an impulse and/or torque (i.e. an instantanious
// change in velocity) based on how well the offset and
// impulse align with the center of mass (aka position).
// If you wanted to immitate this function you could
// work out the impulse and torque and call add_impulse
// and add_torque respectively.
////////////////////////////////////////////////////////////////////
void PhysicsObject::
add_impact(const LPoint3f &offset_from_center_of_mass,
const LVector3f &force) {
nassertv(!offset_from_center_of_mass.is_nan());
nassertv(!force.is_nan());
LRotationf torque;
LVector3f impulse;
torque = LRotationf::ident_quat(); // place holder
impulse = LVector3f::zero(); // place holder
add_torque(torque);
add_impulse(impulse);
}
////////////////////////////////////////////////////////////////////
// Function : get_lcs
// Access : Public