Could anyone please explain btRigidBody::applyForce parameters, please?
Obviously rel_pos should be relative to ceneter of RigidBody mass,
that is, in local coordinates.
But how should be force specified?
Here is the code:
Code: Select all
void applyForce(const btVector3& force, const btVector3& rel_pos)
{
applyCentralForce(force);
applyTorque(rel_pos.cross(force)*m_angularFactor);
}
but then in next line we are crossing it with rel_pos, which is local for sure. Why?
Update:
Actually, the only way for me to get realistic behavior was to modify above code like this:
Code: Select all
void applyForce(const btVector3& force, const btVector3& rel_pos)
{
applyCentralForce(force);
btTransform rotate_with_body;
rotate_with_body.setIdentity();
rotate_with_body.setRotation( getCenterOfMassTransform().getRotation() );
applyTorque(rotate_with_body(rel_pos).cross(force)*m_angularFactor);
}
Still I'm not too sure I'm doing the right thing so please comment...