mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-26 23:59:30 +00:00
Makes vehicles work with the physics plugins.
Makes vehicles create a basic physics body when using one of the physics plugins so that they can collide with other physics-enabled objects. Based on @rextimmy 's work.
This commit is contained in:
parent
5122360552
commit
37e030f8f4
9 changed files with 161 additions and 2 deletions
|
|
@ -378,3 +378,25 @@ void BtBody::setSimulationEnabled( bool enabled )
|
|||
|
||||
mIsEnabled = enabled;
|
||||
}
|
||||
|
||||
void BtBody::moveKinematicTo(const MatrixF &transform)
|
||||
{
|
||||
AssertFatal(mActor, "BtBody::moveKinematicTo - The actor is null!");
|
||||
|
||||
U32 bodyflags = mActor->getCollisionFlags();
|
||||
const bool isKinematic = bodyflags & BF_KINEMATIC;
|
||||
if (!isKinematic)
|
||||
{
|
||||
Con::errorf("BtBody::moveKinematicTo is only for kinematic bodies.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCenterOfMass)
|
||||
{
|
||||
MatrixF xfm;
|
||||
xfm.mul(transform, *mCenterOfMass);
|
||||
mActor->setCenterOfMassTransform(btCast<btTransform>(xfm));
|
||||
}
|
||||
else
|
||||
mActor->setCenterOfMassTransform(btCast<btTransform>(transform));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue