Added some helper methods for constraints and btMatrix3x3,
Thanks to francois, See Issue 466 Prevent crash in SoftBodyDemo, when picking constraints and demo-mode switches to next demo.
This commit is contained in:
@@ -851,19 +851,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
if (m_pickConstraint && m_dynamicsWorld)
|
||||
{
|
||||
m_dynamicsWorld->removeConstraint(m_pickConstraint);
|
||||
delete m_pickConstraint;
|
||||
//printf("removed constraint %i",gPickingConstraintId);
|
||||
m_pickConstraint = 0;
|
||||
pickedBody->forceActivationState(ACTIVE_TAG);
|
||||
pickedBody->setDeactivationTime( 0.f );
|
||||
pickedBody = 0;
|
||||
}
|
||||
|
||||
|
||||
removePickingConstraint();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -876,6 +864,20 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
|
||||
|
||||
}
|
||||
|
||||
void DemoApplication::removePickingConstraint()
|
||||
{
|
||||
if (m_pickConstraint && m_dynamicsWorld)
|
||||
{
|
||||
m_dynamicsWorld->removeConstraint(m_pickConstraint);
|
||||
delete m_pickConstraint;
|
||||
//printf("removed constraint %i",gPickingConstraintId);
|
||||
m_pickConstraint = 0;
|
||||
pickedBody->forceActivationState(ACTIVE_TAG);
|
||||
pickedBody->setDeactivationTime( 0.f );
|
||||
pickedBody = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DemoApplication::mouseMotionFunc(int x,int y)
|
||||
{
|
||||
|
||||
@@ -1330,6 +1332,8 @@ void DemoApplication::renderme()
|
||||
|
||||
void DemoApplication::clientResetScene()
|
||||
{
|
||||
removePickingConstraint();
|
||||
|
||||
#ifdef SHOW_NUM_DEEP_PENETRATIONS
|
||||
gNumDeepPenetrationChecks = 0;
|
||||
gNumGjkChecks = 0;
|
||||
|
||||
Reference in New Issue
Block a user