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

Method detachShape

physx/source/physx/src/NpShapeManager.cpp:105–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105bool NpShapeManager::detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch)
106{
107 PX_ASSERT(!mPruningStructure);
108
109 const PxU32 index = mShapes.find(&s);
110 if(index==0xffffffff)
111 return false;
112
113 NpScene* scene = NpActor::getAPIScene(actor);
114 if(scene && isSceneQuery(s))
115 {
116 scene->getSceneQueryManagerFast().removePrunerShape(mSqCompoundId, getPrunerData(index));
117 // if this is the last shape of a compound shape, we have to remove the compound id
118 // and in case of a dynamic actor, remove it from the active list
119 if(isSqCompound() && (mShapes.getCount() == 1))
120 {
121 mSqCompoundId = INVALID_PRUNERHANDLE;
122 const PxType actorType = actor.getConcreteType();
123 const bool isDynamic = actorType == PxConcreteType::eRIGID_DYNAMIC || actorType == PxConcreteType::eARTICULATION_LINK;
124 if(isDynamic)
125 {
126 // for PxRigidDynamic and PxArticulationLink we need to remove the compound rigid flag and remove them from active list
127 if(actor.is<PxRigidDynamic>())
128 const_cast<NpRigidDynamic&>(static_cast<const NpRigidDynamic&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound();
129 else
130 {
131 if(actor.is<PxArticulationLink>())
132 const_cast<NpArticulationLink&>(static_cast<const NpArticulationLink&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound();
133 }
134 }
135 }
136 }
137
138 Scb::RigidObject& ro = static_cast<Scb::RigidObject&>(NpActor::getScbFromPxActor(actor));
139 ro.onShapeDetach(s.getScbShape(), wakeOnLostTouch, (s.getRefCount() == 1));
140 PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager();
141 mShapes.replaceWithLast(index, sm);
142 mSceneQueryData.replaceWithLast(index, sm);
143
144 s.onActorDetach();
145 return true;
146}
147
148void NpShapeManager::detachAll(NpScene* scene, const PxRigidActor& actor)
149{

Callers 1

detachMethod · 0.45

Calls 12

isSceneQueryFunction · 0.85
isSqCompoundFunction · 0.85
removePrunerShapeMethod · 0.80
disableCompoundMethod · 0.80
onShapeDetachMethod · 0.80
getRefCountMethod · 0.80
onActorDetachMethod · 0.80
findMethod · 0.45
getCountMethod · 0.45
getConcreteTypeMethod · 0.45
getSimMethod · 0.45
replaceWithLastMethod · 0.45

Tested by

no test coverage detected