mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-19 04:10:54 +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
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue