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 */
| 308 | * @return True if the point is inside the body |
| 309 | */ |
| 310 | bool 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 |