diff --git a/activeGameState.cpp b/activeGameState.cpp index c21e054..7fa0791 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -403,7 +403,7 @@ namespace battleship{ Vector3 endPos = screenToSpace(getCursorPos()); Vector3 rayDir = (endPos - camPos).norm(); - vector results = RayCaster::cast(camPos, rayDir, Map::getSingleton()->getNodeParent()); + vector results = RayCaster::cast(camPos, rayDir, Map::getSingleton()->getNodeParent(), 0, configData::DIST_FROM_RAY); if(!results.empty()){ GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton(); @@ -414,7 +414,7 @@ namespace battleship{ Node *nodeParent = map->getNodeParent(); if(u->getType() == UnitType::UNDERWATER && nodeParent->getNumChildren() > 0){ - vector res = RayCaster::cast(Vector3(pos.x, 100, pos.z), Vector3(0, -1, 0), nodeParent->getChild(0)); + vector res = RayCaster::cast(Vector3(pos.x, 100, pos.z), Vector3(0, -1, 0), nodeParent->getChild(0), 0, configData::DIST_FROM_RAY); Vector3 waterBodyPos = Vector3::VEC_ZERO; Vector3 cellSize = map->getCellSize(); @@ -626,7 +626,13 @@ namespace battleship{ depth += 0.05; Vector3 startPos = Root::getSingleton()->getCamera()->getPosition(); - vector results = RayCaster::cast(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0)); + vector results = RayCaster::cast( + startPos, + (screenToSpace(getCursorPos()) - startPos).norm(), + Map::getSingleton()->getNodeParent()->getChild(0), + 0, + configData::DIST_FROM_RAY + ); if(!results.empty()) ufCtr->setPaintSelectRowStart(results[0].pos); diff --git a/defConfigs.h b/defConfigs.h index fd85b1f..dc02f82 100755 --- a/defConfigs.h +++ b/defConfigs.h @@ -20,8 +20,8 @@ namespace battleship{ using namespace gameBase; const std::string DEFAULT_TEXTURE = "Textures/defaultTexture.jpg"; - const double camPanSpeed = .5, CAMERA_DISTANCE = 100, CAMERA_ZOOM_INCREMENT = 1, NUM_MAX_ZOOMS = 75, cellLength = 14, cellWidth = 14, cellDepth = 7; - const int maxNumGroups = 10; + const double camPanSpeed = .5, CAMERA_DISTANCE = 100, CAMERA_ZOOM_INCREMENT = 1, cellLength = 14, cellWidth = 14, cellDepth = 7, DIST_FROM_RAY = 20; + const int maxNumGroups = 10, NUM_MAX_ZOOMS = 75; const vb01::u32 IMPASS_NODE_VAL = 65535; const static int numAppStates = 4; diff --git a/external/gameBase b/external/gameBase index e71e5ce..5945179 160000 --- a/external/gameBase +++ b/external/gameBase @@ -1 +1 @@ -Subproject commit e71e5ce63ef932879ec3d5d3f308e9f3e74e0954 +Subproject commit 59451791f37e4d9a0b7966f5ecd48101063ffa63 diff --git a/external/vb01 b/external/vb01 index 4682085..6077cf9 160000 --- a/external/vb01 +++ b/external/vb01 @@ -1 +1 @@ -Subproject commit 46820858842f99e5d5f6f86b9c6a0b4d372e607f +Subproject commit 6077cf9cdea190eba994716a74ca67e511d196d0 diff --git a/gameObjectFrameController.cpp b/gameObjectFrameController.cpp index 04c593e..77ca234 100644 --- a/gameObjectFrameController.cpp +++ b/gameObjectFrameController.cpp @@ -2,6 +2,7 @@ #include "gameObjectFrameController.h" #include "resourceDeposit.h" +#include "defConfigs.h" #include "player.h" #include "game.h" #include "unit.h" @@ -118,7 +119,13 @@ namespace battleship{ frame.update(); Vector3 startPos = Root::getSingleton()->getCamera()->getPosition(); - vector results = RayCaster::cast(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0)); + vector results = RayCaster::cast( + startPos, + (screenToSpace(getCursorPos()) - startPos).norm(), + Map::getSingleton()->getNodeParent()->getChild(0), + 0, + configData::DIST_FROM_RAY + ); if(results.empty()) return; diff --git a/mapEditorAppState.cpp b/mapEditorAppState.cpp index 6963038..8e1b753 100644 --- a/mapEditorAppState.cpp +++ b/mapEditorAppState.cpp @@ -317,7 +317,7 @@ namespace battleship{ for(int i = 0; i < numVertCells; i++) for(int j = 0; j < numHorCells; j++){ Vector3 rayPos = startPos + Vector3(cellSize.x * j, 100, cellSize.z * i); - vector res = RayCaster::cast(rayPos, -Vector3::VEC_J, terrainNode->getChild(0), 0, 4); + vector res = RayCaster::cast(rayPos, -Vector3::VEC_J, terrainNode->getChild(0), 0, configData::DIST_FROM_RAY); if(res.empty()){ RayCaster::CollisionResult r; @@ -627,7 +627,13 @@ namespace battleship{ Vector2 cursorPos = getCursorPos(); Vector3 endPos = screenToSpace(cursorPos); - vector results = RayCaster::cast(startPos, (endPos - startPos).norm(), Root::getSingleton()->getRootNode()); + vector results = RayCaster::cast( + startPos, + (endPos - startPos).norm(), + Root::getSingleton()->getRootNode(), + 0, + configData::DIST_FROM_RAY + ); if(cursorPos.y < GameManager::getSingleton()->getHeight() - mapEditor->getGuiThreshold()){ bool push = !results.empty();