mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:14:35 +02:00
Update findRayRectangleIntersection to set out variable distance
This commit is contained in:
parent
880c8f370f
commit
14ec9b431e
2 changed files with 5 additions and 5 deletions
|
@ -494,8 +494,8 @@ void PolygonClip::copyCleanArray(int& lengthA, glm::vec2* vertexArrayA, int& len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::quat& rotation,
|
||||||
const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions) {
|
const glm::vec3& position, const glm::vec2& dimensions, float& distance) {
|
||||||
RayIntersectionInfo rayInfo;
|
RayIntersectionInfo rayInfo;
|
||||||
rayInfo._rayStart = origin;
|
rayInfo._rayStart = origin;
|
||||||
rayInfo._rayDirection = direction;
|
rayInfo._rayDirection = direction;
|
||||||
|
@ -511,7 +511,7 @@ bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& dire
|
||||||
bool intersects = plane.findRayIntersection(rayInfo);
|
bool intersects = plane.findRayIntersection(rayInfo);
|
||||||
|
|
||||||
if (intersects) {
|
if (intersects) {
|
||||||
float distance = rayInfo._hitDistance;
|
distance = rayInfo._hitDistance;
|
||||||
|
|
||||||
glm::vec3 hitPosition = origin + (distance * direction);
|
glm::vec3 hitPosition = origin + (distance * direction);
|
||||||
glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - position);
|
glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - position);
|
||||||
|
|
|
@ -76,8 +76,8 @@ bool findRaySphereIntersection(const glm::vec3& origin, const glm::vec3& directi
|
||||||
bool findRayCapsuleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool findRayCapsuleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||||
const glm::vec3& start, const glm::vec3& end, float radius, float& distance);
|
const glm::vec3& start, const glm::vec3& end, float radius, float& distance);
|
||||||
|
|
||||||
bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::quat& rotation,
|
||||||
const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions);
|
const glm::vec3& position, const glm::vec2& dimensions, float& distance);
|
||||||
|
|
||||||
bool findRayTriangleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool findRayTriangleIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||||
const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, float& distance);
|
const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, float& distance);
|
||||||
|
|
Loading…
Reference in a new issue