using the new ray casting implementation

This commit is contained in:
devZoGok
2023-11-04 17:41:15 +02:00
parent acc5ad325b
commit 4a9e9bd4c9
6 changed files with 15 additions and 32 deletions
+3 -4
View File
@@ -10,7 +10,7 @@
#include <mesh.h>
#include <model.h>
#include <root.h>
#include <ray.h>
#include <rayCaster.h>
#include <string>
@@ -97,9 +97,8 @@ namespace battleship{
frame.update();
Vector3 startPos = Root::getSingleton()->getCamera()->getPosition();
vector<Ray::CollisionResult> results;
Ray::retrieveCollisions(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0), results);
Ray::sortResults(results);
vector<RayCaster::CollisionResult> results = RayCaster::cast(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0));
if(results.empty()) return;
Vector3 newPos, rowEnd;