Stop nxogre during the simulation

shenakan

07-04-2008 19:11:23

I would like to know if there a way to stop to apply the physic like gravity during the simulation. I have an interface to build a body and it is not easy to build it with the physic is enable. But i need to enable and stop during the simulation. I think it is easy to do ?

betajaen

07-04-2008 19:35:17

Freeze the actor by raising a body flag. "NX_BF_FROZEN" I think.

dbrock

07-04-2008 20:53:55

Look at the ragdoll posts, they need to stop/enable collisions.

This is what I found

void cRagDoll::_setControlToBones()
{
for (int i=0; i<15; i++)
{
mBoneBoneActorBind[i].BoneActor->raiseActorFlag(NX_AF_DISABLE_COLLISION);
mBoneBoneActorBind[i].BoneActor->raiseBodyFlag(NX_BF_KINEMATIC);
mBoneBoneActorBind[i].BoneActor->putToSleep();
}
}

void cRagDoll::_setControlToBoneActors()
{
//updateBoneActors();
setAllBonesToManualControll(true);
resetAllBones();

//disabling all animations
Ogre::Entity* e=(Ogre::Entity*)mCharacterSN->getAttachedObject(0);
Ogre::AnimationStateSet* set=e->getAllAnimationStates();
Ogre::AnimationStateIterator it = set->getAnimationStateIterator();
Ogre::AnimationState *anim;

while(it.hasMoreElements())
{
anim = it.getNext();
anim->setEnabled(false);
anim->setWeight(0);
}

for (int i=0; i<15; i++)
{
mBoneBoneActorBind[i].BoneActor->clearActorFlag(NX_AF_DISABLE_COLLISION);
mBoneBoneActorBind[i].BoneActor->clearBodyFlag(NX_BF_KINEMATIC);
mBoneBoneActorBind[i].BoneActor->wakeUp();
mBoneBoneActorBind[i].BoneActor->setAngularDamping(1.0);
mBoneBoneActorBind[i].BoneActor->setLinearDamping(1.0);
}
}