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

Method raycast

src/collision/shapes/HeightFieldShape.cpp:76–86  ·  view source on GitHub ↗

Raycast method with feedback information Note that only the first triangle hit by the ray in the mesh will be returned, even if the ray hits many triangles.

Source from the content-addressed store, hash-verified

74/// Note that only the first triangle hit by the ray in the mesh will be returned, even if
75/// the ray hits many triangles.
76bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collider* collider, MemoryAllocator& allocator) const {
77
78 RP3D_PROFILE("HeightFieldShape::raycast()", mProfiler);
79
80 // Apply the collision shape inverse scaling factor because the height-field is stored without scaling
81 // inside the dynamic AABB tree
82 const Vector3 inverseScale(decimal(1.0) / mScale.x, decimal(1.0) / mScale.y, decimal(1.0) / mScale.z);
83 Ray scaledRay(ray.point1 * inverseScale, ray.point2 * inverseScale, ray.maxFraction);
84
85 return mHeightField->raycast(scaledRay, raycastInfo, collider, getRaycastTestType(), allocator, mScale);
86}
87
88// Return the string representation of the shape
89std::string HeightFieldShape::to_string() const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected