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

Method removeArticulationInternal

physx/source/physx/src/NpScene.cpp:998–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

996}
997
998void NpScene::removeArticulationInternal(PxArticulationBase& npa, bool wakeOnLostTouch, bool removeFromAggregate)
999{
1000 PxU32 nbLinks = npa.getNbLinks();
1001 PX_ASSERT(nbLinks > 0);
1002
1003 if(removeFromAggregate && npa.getAggregate())
1004 {
1005 static_cast<NpAggregate*>(npa.getAggregate())->removeArticulationAndReinsert(npa, false);
1006 PX_ASSERT(!npa.getAggregate());
1007 }
1008
1009 //!!!AL
1010 // Inefficient. We might want to introduce a LL method to kill the whole LL articulation together with all joints in one go, then
1011 // the order of removing the links/joints does not matter anymore.
1012
1013 // Remove links & joints
1014 PX_ALLOCA(linkStack, NpArticulationLink*, nbLinks);
1015 linkStack[0] = reinterpret_cast<PxArticulationImpl*>(npa.getImpl())->getLinks()[0];
1016 PxU32 curLink = 0, stackSize = 1;
1017
1018 while(curLink < (nbLinks-1))
1019 {
1020 PX_ASSERT(curLink < stackSize);
1021 NpArticulationLink* l = linkStack[curLink];
1022 NpArticulationLink*const* children = l->getChildren();
1023
1024 for(PxU32 i=0; i < l->getNbChildren(); i++)
1025 {
1026 linkStack[stackSize] = children[i];
1027 stackSize++;
1028 }
1029
1030 curLink++;
1031 }
1032
1033 PxRigidBodyFlags flag;
1034 for(PxI32 j=PxI32(nbLinks); j-- > 0; )
1035 {
1036 flag |=linkStack[j]->getScbBodyFast().getScBody().getCore().mFlags;
1037 removeArticulationLink(*linkStack[j], wakeOnLostTouch);
1038 }
1039
1040 if (flag & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD)
1041 {
1042 PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(npa.getImpl());
1043 IG::NodeIndex index = impl->getScbArticulation().getScArticulation().getIslandNodeIndex();
1044 if (index.isValid())
1045 mScene.getScScene().resetSpeculativeCCDArticulationLink(index.index());
1046 }
1047 // Remove articulation
1048 mScene.removeArticulation(reinterpret_cast<PxArticulationImpl*>(npa.getImpl())->getArticulation());
1049
1050
1051 removeFromArticulationList(npa);
1052}
1053
1054///////////////////////////////////////////////////////////////////////////////
1055

Callers

nothing calls this directly

Calls 13

getIslandNodeIndexMethod · 0.80
indexMethod · 0.80
getArticulationMethod · 0.80
getNbLinksMethod · 0.45
getAggregateMethod · 0.45
getLinksMethod · 0.45
getImplMethod · 0.45
getChildrenMethod · 0.45
getNbChildrenMethod · 0.45
getCoreMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected