MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / detachShape

Method detachShape

deps/physx/physx/source/physx/src/NpShapeManager.cpp:127–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool NpShapeManager::detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch)
128{
129 PX_ASSERT(!mPruningStructure);
130
131 const PxU32 index = mShapes.find(&s);
132 if(index==0xffffffff)
133 return false;
134
135 NpScene* scene = NpActor::getAPIScene(actor);
136 if(scene && isSceneQuery(s))
137 {
138 scene->getSceneQueryManagerFast().removePrunerShape(mSqCompoundId, getPrunerData(index));
139 // if this is the last shape of a compound shape, we have to remove the compound id
140 // and in case of a dynamic actor, remove it from the active list
141 if(isSqCompound() && (mShapes.getCount() == 1))
142 {
143 mSqCompoundId = INVALID_PRUNERHANDLE;
144 const PxType actorType = actor.getConcreteType();
145 const bool isDynamic = actorType == PxConcreteType::eRIGID_DYNAMIC || actorType == PxConcreteType::eARTICULATION_LINK;
146 if(isDynamic)
147 {
148 // for PxRigidDynamic and PxArticulationLink we need to remove the compound rigid flag and remove them from active list
149 if(actor.is<PxRigidDynamic>())
150 const_cast<NpRigidDynamic&>(static_cast<const NpRigidDynamic&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound();
151 else
152 {
153 if(actor.is<PxArticulationLink>())
154 const_cast<NpArticulationLink&>(static_cast<const NpArticulationLink&>(actor)).getScbBodyFast().getScBody().getSim()->disableCompound();
155 }
156 }
157 }
158 }
159
160 Scb::RigidObject& ro = static_cast<Scb::RigidObject&>(NpActor::getScbFromPxActor(actor));
161 ro.onShapeDetach(s.getScbShape(), wakeOnLostTouch, (s.getRefCount() == 1));
162 PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager();
163 mShapes.replaceWithLast(index, sm);
164 mSceneQueryData.replaceWithLast(index, sm);
165
166 s.onActorDetach();
167 return true;
168}
169
170void NpShapeManager::detachAll(NpScene* scene, const PxRigidActor& actor)
171{

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