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:
Areloch 2016-06-04 16:47:03 -05:00
parent 5122360552
commit 37e030f8f4
9 changed files with 161 additions and 2 deletions

View file

@ -417,3 +417,22 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force )
}
void Px3Body::moveKinematicTo(const MatrixF &transform)
{
AssertFatal(mActor, "Px3Body::moveKinematicTo - The actor is null!");
const bool isKinematic = mBodyFlags & BF_KINEMATIC;
if (!isKinematic)
{
Con::errorf("Px3Body::moveKinematicTo is only for kinematic bodies.");
return;
}
mWorld->lockScene();
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setKinematicTarget(px3Cast<physx::PxTransform>(transform));
mWorld->unlockScene();
}