mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 01:31:37 +02:00
coding standard, added comments
This commit is contained in:
parent
b9891748e1
commit
dd4f3a4006
1 changed files with 4 additions and 1 deletions
|
@ -111,8 +111,11 @@ bool SphereEntityItem::findDetailedRayIntersection(const glm::vec3& origin, cons
|
||||||
glm::vec3 entityFrameDirection = glm::normalize(glm::vec3(worldToEntityMatrix * glm::vec4(direction, 1.0f)));
|
glm::vec3 entityFrameDirection = glm::normalize(glm::vec3(worldToEntityMatrix * glm::vec4(direction, 1.0f)));
|
||||||
|
|
||||||
float localDistance;
|
float localDistance;
|
||||||
|
// NOTE: unit sphere has center of 0,0,0 and radius of 0.5
|
||||||
if (findRaySphereIntersection(entityFrameOrigin, entityFrameDirection, glm::vec3(0.0f), 0.5f, localDistance)) {
|
if (findRaySphereIntersection(entityFrameOrigin, entityFrameDirection, glm::vec3(0.0f), 0.5f, localDistance)) {
|
||||||
|
// determine where on the unit sphere the hit point occured
|
||||||
glm::vec3 entityFrameHitAt = entityFrameOrigin + (entityFrameDirection * localDistance);
|
glm::vec3 entityFrameHitAt = entityFrameOrigin + (entityFrameDirection * localDistance);
|
||||||
|
// then translate back to work coordinates
|
||||||
glm::vec3 hitAt = glm::vec3(entityToWorldMatrix * glm::vec4(entityFrameHitAt, 1.0f));
|
glm::vec3 hitAt = glm::vec3(entityToWorldMatrix * glm::vec4(entityFrameHitAt, 1.0f));
|
||||||
distance = glm::distance(origin,hitAt);
|
distance = glm::distance(origin,hitAt);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue