MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetRayFrom2DPosition

Function GetRayFrom2DPosition

TombEngine/Game/collision/Los.cpp:477–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475 }
476
477 std::pair<GameVector, GameVector> GetRayFrom2DPosition(const Vector2& screenPos)
478 {
479 auto posPair = g_Renderer.GetRay(screenPos);
480
481 auto dir = posPair.second - posPair.first;
482 dir.Normalize();
483 float dist = Vector3::Distance(posPair.first, posPair.second);
484
485 auto roomLos = GetRoomLosCollision(posPair.first, Camera.pos.RoomNumber, dir, dist);
486
487 auto origin = GameVector(posPair.first, Camera.pos.RoomNumber);
488 auto target = GameVector(roomLos.Position, roomLos.RoomNumber);
489 return std::pair(origin, target);
490 }
491}

Callers 2

PickMoveableFunction · 0.85
PickStaticFunction · 0.85

Calls 4

GetRoomLosCollisionFunction · 0.85
GetRayMethod · 0.80
GameVectorClass · 0.70
NormalizeMethod · 0.45

Tested by

no test coverage detected