diff options
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp')
| -rw-r--r-- | PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp b/PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp index 3a0cc9c7..4ce57c13 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScBodySim.cpp @@ -93,7 +93,7 @@ Sc::BodySim::BodySim(Scene& scene, BodyCore& core) : hasPendingForce = (velmod->flags != 0) && (!velmod->getLinearVelModPerSec().isZero() || !velmod->getAngularVelModPerSec().isZero() || !velmod->getLinearVelModPerStep().isZero() || !velmod->getAngularVelModPerStep().isZero()); - mVelModState = velmod->flags; + mVelModState = velmod->flags; velmod->flags = 0; } @@ -121,6 +121,12 @@ Sc::BodySim::BodySim(Scene& scene, BodyCore& core) : } } + + //If a user add force or torque before the body is inserted into the scene, + //this logic will make sure pre solver stage apply external force/torque to the body + if(hasPendingForce && !isArticulationLink()) + scene.getVelocityModifyMap().growAndSet(mNodeIndex.index()); + PX_ASSERT(mActiveListIndex == SC_NOT_IN_SCENE_INDEX); setActive(isAwake, ActorSim::AS_PART_OF_CREATION); @@ -493,10 +499,10 @@ void Sc::BodySim::activateInteractions(PxU32 /*infoFlag*/) Ps::prefetchLine(mInteractions[PxMin(i+1,nbInteractions-1)]); Interaction* interaction = mInteractions[i]; - bool isNotIGControlled = interaction->getType() != Sc::InteractionType::eCONSTRAINTSHADER && interaction->getType() != Sc::InteractionType::eOVERLAP && + bool isNotIGControlled = interaction->getType() != Sc::InteractionType::eOVERLAP && interaction->getType() != Sc::InteractionType::eMARKER; - if (!interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE) && isNotIGControlled) + if (!interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE) && (isNotIGControlled)) { const bool proceed = interaction->onActivate(NULL); if (proceed && (interaction->getType() < InteractionType::eTRACKED_IN_SCENE_COUNT)) @@ -515,7 +521,7 @@ void Sc::BodySim::deactivateInteractions(PxU32 infoFlag) Ps::prefetchLine(mInteractions[PxMin(i+1,nbInteractions-1)]); Interaction* interaction = mInteractions[i]; - bool isNotIGControlled = interaction->getType() != Sc::InteractionType::eCONSTRAINTSHADER && interaction->getType() != Sc::InteractionType::eOVERLAP && + bool isNotIGControlled = interaction->getType() != Sc::InteractionType::eOVERLAP && interaction->getType() != Sc::InteractionType::eMARKER; if (interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE) && isNotIGControlled) |