MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / putObjectsToSleep

Method putObjectsToSleep

physx/source/simulationcontroller/src/ScScene.cpp:2534–2562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2532}
2533
2534PX_FORCE_INLINE void Sc::Scene::putObjectsToSleep(PxU32 infoFlag)
2535{
2536 PX_PROFILE_ZONE("Sc::Scene::putObjectsToSleep", getContextId());
2537 const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim();
2538
2539 //Set to sleep all bodies that were in awake islands that have just been put to sleep.
2540 const PxU32 nbBodiesToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE);
2541 const IG::NodeIndex*const bodyIndices = islandSim.getNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE);
2542
2543 for(PxU32 i=0;i<nbBodiesToSleep;i++)
2544 {
2545 PxsRigidBody* rigidBody = islandSim.getRigidBody(bodyIndices[i]);
2546 if (rigidBody && !islandSim.getNode(bodyIndices[i]).isActive())
2547 {
2548 Sc::BodySim* bodySim = reinterpret_cast<BodySim*>(reinterpret_cast<PxU8*>(rigidBody) - Sc::BodySim::getRigidBodyOffset());
2549 bodySim->setActive(false, infoFlag);
2550 }
2551 }
2552
2553 const PxU32 nbArticulationsToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eARTICULATION_TYPE);
2554 const IG::NodeIndex*const articIndices = islandSim.getNodesToDeactivate(IG::Node::eARTICULATION_TYPE);
2555
2556 for(PxU32 i=0;i<nbArticulationsToSleep;i++)
2557 {
2558 Sc::ArticulationSim* articSim = islandSim.getLLArticulation(articIndices[i])->getArticulationSim();
2559 if (articSim && !islandSim.getNode(articIndices[i]).isActive())
2560 articSim->setActive(false, infoFlag);
2561 }
2562}
2563
2564PX_FORCE_INLINE void Sc::Scene::putInteractionsToSleep()
2565{

Callers

nothing calls this directly

Calls 7

getNodesToDeactivateMethod · 0.80
getRigidBodyMethod · 0.80
getNodeMethod · 0.80
getContextIdFunction · 0.50
isActiveMethod · 0.45
setActiveMethod · 0.45

Tested by

no test coverage detected