mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
code cleanup
This commit is contained in:
parent
d58a69e76c
commit
87ba9a7084
4 changed files with 17 additions and 44 deletions
|
|
@ -147,10 +147,6 @@ bool Px3Body::init( PhysicsCollision *shape,
|
|||
{
|
||||
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
|
||||
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
|
||||
if(mBodyFlags & BF_CCD)
|
||||
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, true);
|
||||
else
|
||||
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, false);
|
||||
}
|
||||
|
||||
// This sucks, but it has to happen if we want
|
||||
|
|
@ -223,7 +219,7 @@ void Px3Body::getState( PhysicsState *outState )
|
|||
outState->linVelocity = px3Cast<Point3F>( actor->getLinearVelocity() );
|
||||
outState->angVelocity = px3Cast<Point3F>( actor->getAngularVelocity() );
|
||||
outState->sleeping = actor->isSleeping();
|
||||
outState->momentum = px3Cast<Point3F>( (1.0f/actor->getMass()) * actor->getLinearVelocity() );//??
|
||||
outState->momentum = px3Cast<Point3F>( (1.0f/actor->getMass()) * actor->getLinearVelocity() );
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -368,24 +364,6 @@ void Px3Body::setSimulationEnabled( bool enabled )
|
|||
|
||||
delete [] shapes;
|
||||
}
|
||||
|
||||
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->releaseWriteLock();
|
||||
|
||||
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
|
||||
actor->setKinematicTarget(px3Cast<physx::PxTransform>(transform));
|
||||
}
|
||||
|
||||
void Px3Body::setTransform( const MatrixF &transform )
|
||||
{
|
||||
AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" );
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ public:
|
|||
// PhysicsObject
|
||||
virtual PhysicsWorld* getWorld();
|
||||
virtual void setTransform( const MatrixF &xfm );
|
||||
virtual void moveKinematicTo( const MatrixF &xfm );
|
||||
virtual MatrixF& getTransform( MatrixF *outMatrix );
|
||||
virtual Box3F getWorldBounds();
|
||||
virtual void setSimulationEnabled( bool enabled );
|
||||
|
|
@ -100,6 +99,7 @@ public:
|
|||
U32 bodyFlags,
|
||||
SceneObject *obj,
|
||||
PhysicsWorld *world );
|
||||
|
||||
virtual bool isDynamic() const;
|
||||
virtual PhysicsCollision* getColShape();
|
||||
virtual void setSleepThreshold( F32 linear, F32 angular );
|
||||
|
|
|
|||
|
|
@ -54,23 +54,6 @@ physx::PxDefaultAllocator Px3World::smMemoryAlloc;
|
|||
F32 Px3World::smPhysicsStepTime = 1.0f/(F32)TickMs;
|
||||
U32 Px3World::smPhysicsMaxIterations = 4;
|
||||
|
||||
//filter shader with support for CCD pairs
|
||||
static physx::PxFilterFlags sCcdFilterShader(
|
||||
physx::PxFilterObjectAttributes attributes0,
|
||||
physx::PxFilterData filterData0,
|
||||
physx::PxFilterObjectAttributes attributes1,
|
||||
physx::PxFilterData filterData1,
|
||||
physx::PxPairFlags& pairFlags,
|
||||
const void* constantBlock,
|
||||
physx::PxU32 constantBlockSize)
|
||||
{
|
||||
pairFlags = physx::PxPairFlag::eRESOLVE_CONTACTS;
|
||||
pairFlags |= physx::PxPairFlag::eCCD_LINEAR;
|
||||
return physx::PxFilterFlags();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Px3World::Px3World(): mScene( NULL ),
|
||||
mProcessList( NULL ),
|
||||
mIsSimulating( false ),
|
||||
|
|
@ -180,7 +163,6 @@ bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *se
|
|||
return false;
|
||||
}
|
||||
|
||||
//just for testing-must remove, should really be enabled via console like physx 2 plugin
|
||||
#ifdef TORQUE_DEBUG
|
||||
physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags());
|
||||
smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(),
|
||||
|
|
@ -241,8 +223,7 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
|||
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
|
||||
|
||||
sceneDesc.filterShader = sCcdFilterShader;
|
||||
sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader;
|
||||
|
||||
mScene = gPhysics3SDK->createScene(sceneDesc);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue