I am making a ray-cast car and the ray-casting is implemented in submit-constraint callback where I add the necessary forces. The problem comes with braking - when brake is applied, I create a linear-row along the longitudinal tangent and set friction values to brake force. This works just fine but the brake forces are only applies to the frame but not the body the car is braking on (for example, a moving ramp), because when initially creating the joint, I set parent body to NULL.
- Code: Select all
if (brakeForce > 0.1f)
{
addLinearRow(contactPosition, contactPosition, longitudinalTangentOrientation * Ogre::Vector3::UNIT_X);
setRowMinimumFriction(-brakeForce);
setRowMaximumFriction(brakeForce);
}
Is it possible to change joint parent body to the body I am braking on (I find the body with raycast), so when I brake on a dynamic object, it would be dragged along with the car instead of the car stopping like the object under it is static.
Or perhaps there is another approach entirely, I am trying to figure ray-cast car out myself and not really using any existing solution so perhaps I'm doing it wrong altogether, although it does work except for the problem described.
Any ideas?
