BGE: When applying movement to an object with the Character physics type, use the btKinematicCharacterController's setWalkDirection() instead of moving the physics object ourselves. This reduces issues with tunneling (the character going through other objects).
This commit is contained in:
@@ -895,18 +895,22 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc
|
||||
return;
|
||||
}
|
||||
|
||||
// btRigidBody* body = GetRigidBody(); // not used anymore
|
||||
|
||||
btVector3 dloc(dlocX,dlocY,dlocZ);
|
||||
btTransform xform = m_object->getWorldTransform();
|
||||
|
||||
if (local)
|
||||
{
|
||||
dloc = xform.getBasis()*dloc;
|
||||
}
|
||||
|
||||
xform.setOrigin(xform.getOrigin() + dloc);
|
||||
SetCenterOfMassTransform(xform);
|
||||
if (m_characterController)
|
||||
{
|
||||
m_characterController->setWalkDirection(dloc/GetPhysicsEnvironment()->getNumTimeSubSteps());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
xform.setOrigin(xform.getOrigin() + dloc);
|
||||
SetCenterOfMassTransform(xform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user