Return true if a point is inside the collision shape
| 183 | |
| 184 | // Return true if a point is inside the collision shape |
| 185 | bool ConvexMeshShape::testPointInside(const Vector3& localPoint, Collider* /*collider*/) const { |
| 186 | |
| 187 | const HalfEdgeStructure& halfEdgeStructure = mConvexMesh->getHalfEdgeStructure(); |
| 188 | |
| 189 | // For each face plane of the convex mesh |
| 190 | for (uint32 f=0; f < mConvexMesh->getNbFaces(); f++) { |
| 191 | |
| 192 | const HalfEdgeStructure::Face& face = halfEdgeStructure.getFace(f); |
| 193 | const Vector3& faceNormal = getFaceNormal(f); |
| 194 | const HalfEdgeStructure::Vertex& faceVertex = halfEdgeStructure.getVertex(face.faceVertices[0]); |
| 195 | const Vector3& facePoint = mConvexMesh->getVertex(faceVertex.vertexPointIndex); |
| 196 | |
| 197 | // If the point is out of the face plane, it is outside of the convex mesh |
| 198 | if (computePointToPlaneDistance(localPoint, faceNormal, facePoint) > decimal(0.0)) return false; |
| 199 | } |
| 200 | |
| 201 | return true; |
| 202 | } |
| 203 | |
| 204 | // Return the local bounds of the shape in x, y and z directions |
| 205 | /** |
nothing calls this directly
no test coverage detected