MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / removeCollider

Method removeCollider

src/body/Body.cpp:166–197  ·  view source on GitHub ↗

Remove a collider from the body To remove a collider, you need to specify its pointer * @param collider The pointer of the collider you want to remove */

Source from the content-addressed store, hash-verified

164 * @param collider The pointer of the collider you want to remove
165 */
166void Body::removeCollider(Collider* collider) {
167
168 RP3D_LOG(mWorld.mConfig.worldName, Logger::Level::Information, Logger::Category::Body,
169 "Body " + std::to_string(mEntity.id) + ": Collider " + std::to_string(collider->getBroadPhaseId()) + " removed from body", __FILE__, __LINE__);
170
171 // Remove the collider from the broad-phase
172 if (collider->getBroadPhaseId() != -1) {
173 mWorld.mCollisionDetection.removeCollider(collider);
174 }
175
176 mWorld.mBodyComponents.removeColliderFromBody(mEntity, collider->getEntity());
177
178 // Unassign the collider from the collision shape
179 collider->getCollisionShape()->removeCollider(collider);
180
181 // Remove the collider component
182 mWorld.mCollidersComponents.removeComponent(collider->getEntity());
183
184 // Destroy the entity
185 mWorld.mEntityManager.destroyEntity(collider->getEntity());
186
187 // Call the constructor of the collider
188 collider->~Collider();
189
190 // Update whether the body still has a simulation collider
191 if (mWorld.mBodyComponents.getHasSimulationCollider(mEntity)) {
192 updateHasSimulationCollider();
193 }
194
195 // Release allocated memory for the collider
196 mWorld.mMemoryManager.release(MemoryManager::AllocationType::Pool, collider, sizeof(Collider));
197}
198
199// Remove all the colliders
200void Body::removeAllColliders() {

Callers 1

setIsActiveMethod · 0.45

Calls 9

removeComponentMethod · 0.80
destroyEntityMethod · 0.80
~ColliderMethod · 0.80
getBroadPhaseIdMethod · 0.45
getEntityMethod · 0.45
getCollisionShapeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected