mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
Merge pull request #97 from DavidWyand-GG/issue96-PhysXCrashOnObjectUpdate
Fix for Issue #96 for DAE updating crash
This commit is contained in:
commit
974e33734c
4 changed files with 22 additions and 2 deletions
|
|
@ -42,6 +42,8 @@ class PhysicsWorld
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Signal<void()> mStaticChangedSignal;
|
||||||
|
|
||||||
Signal<void()> mUpdateSignal;
|
Signal<void()> mUpdateSignal;
|
||||||
|
|
||||||
/// The current gravity force.
|
/// The current gravity force.
|
||||||
|
|
@ -58,6 +60,9 @@ public:
|
||||||
///
|
///
|
||||||
Signal<void()>& getUpdateSignal() { return mUpdateSignal; }
|
Signal<void()>& getUpdateSignal() { return mUpdateSignal; }
|
||||||
|
|
||||||
|
// Called when a static body in the scene has been removed.
|
||||||
|
Signal<void()>& getStaticChangedSignal() { return mStaticChangedSignal; }
|
||||||
|
|
||||||
/// Overloaded to do debug drawing.
|
/// Overloaded to do debug drawing.
|
||||||
///
|
///
|
||||||
/// It is assumed the GFX state is setup prior to this call for
|
/// It is assumed the GFX state is setup prior to this call for
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ void PxPlayer::_releaseController()
|
||||||
if ( mController )
|
if ( mController )
|
||||||
{
|
{
|
||||||
mController->getActor()->userData = NULL;
|
mController->getActor()->userData = NULL;
|
||||||
mWorld->releaseController( *mController );
|
mWorld->getStaticChangedSignal().remove( this, &PxPlayer::_onStaticChanged );
|
||||||
|
mWorld->releaseController( *mController );
|
||||||
mController = NULL;
|
mController = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +100,8 @@ void PxPlayer::init( const char *type,
|
||||||
//mOriginOffset = 1.0f;
|
//mOriginOffset = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mWorld->getStaticChangedSignal().notify( this, &PxPlayer::_onStaticChanged );
|
||||||
|
|
||||||
// Put the kinematic actor on group 29.
|
// Put the kinematic actor on group 29.
|
||||||
NxActor *kineActor = mController->getActor();
|
NxActor *kineActor = mController->getActor();
|
||||||
kineActor->setGroup( 29 );
|
kineActor->setGroup( 29 );
|
||||||
|
|
@ -110,6 +113,11 @@ void PxPlayer::init( const char *type,
|
||||||
kineActor->userData = &mUserData;
|
kineActor->userData = &mUserData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PxPlayer::_onStaticChanged()
|
||||||
|
{
|
||||||
|
mController->reportSceneChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void PxPlayer::_onPhysicsReset( PhysicsResetEvent reset )
|
void PxPlayer::_onPhysicsReset( PhysicsResetEvent reset )
|
||||||
{
|
{
|
||||||
// The PhysX controller will crash out if it doesn't clear its
|
// The PhysX controller will crash out if it doesn't clear its
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ protected:
|
||||||
|
|
||||||
void _onPhysicsReset( PhysicsResetEvent reset );
|
void _onPhysicsReset( PhysicsResetEvent reset );
|
||||||
|
|
||||||
|
void _onStaticChanged();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PxPlayer();
|
PxPlayer();
|
||||||
|
|
|
||||||
|
|
@ -569,9 +569,11 @@ void PxWorld::_releaseQueues()
|
||||||
mReleaseJointQueue.clear();
|
mReleaseJointQueue.clear();
|
||||||
|
|
||||||
// Now release any actors still pending in the queue.
|
// Now release any actors still pending in the queue.
|
||||||
|
bool staticChanged = false;
|
||||||
for ( S32 i = 0; i < mReleaseActorQueue.size(); i++ )
|
for ( S32 i = 0; i < mReleaseActorQueue.size(); i++ )
|
||||||
{
|
{
|
||||||
NxActor *currActor = mReleaseActorQueue[i];
|
NxActor *currActor = mReleaseActorQueue[i];
|
||||||
|
staticChanged |= !currActor->isDynamic();
|
||||||
mScene->releaseActor( *currActor );
|
mScene->releaseActor( *currActor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -618,6 +620,9 @@ void PxWorld::_releaseQueues()
|
||||||
mScene->releaseFluid( *currFluid );
|
mScene->releaseFluid( *currFluid );
|
||||||
}
|
}
|
||||||
mReleaseFluidQueue.clear();
|
mReleaseFluidQueue.clear();
|
||||||
|
|
||||||
|
if ( staticChanged )
|
||||||
|
mStaticChangedSignal.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PxWorld::setEnabled( bool enabled )
|
void PxWorld::setEnabled( bool enabled )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue