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

Method testPointInside

src/body/Body.cpp:310–323  ·  view source on GitHub ↗

Return true if a point is inside the collision body This method returns true if a point is inside any collision shape of the body * @param worldPoint The point to test (in world-space coordinates) * @return True if the point is inside the body */

Source from the content-addressed store, hash-verified

308 * @return True if the point is inside the body
309 */
310bool Body::testPointInside(const Vector3& worldPoint) const {
311
312 // For each collider of the body
313 const Array<Entity>& colliderEntities = mWorld.mBodyComponents.getColliders(mEntity);
314 for (uint32 i=0; i < colliderEntities.size(); i++) {
315
316 Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]);
317
318 // Test if the point is inside the collider
319 if (collider->testPointInside(worldPoint)) return true;
320 }
321
322 return false;
323}
324
325// Raycast method with feedback information
326/// The method returns the closest hit among all the collision shapes of the body

Callers 5

testBoxMethod · 0.45
testSphereMethod · 0.45
testCapsuleMethod · 0.45
testConvexMeshMethod · 0.45
testCompoundMethod · 0.45

Calls 2

sizeMethod · 0.45
getColliderMethod · 0.45

Tested by 5

testBoxMethod · 0.36
testSphereMethod · 0.36
testCapsuleMethod · 0.36
testConvexMeshMethod · 0.36
testCompoundMethod · 0.36