From ca0c31c2083386e3fa931edfb88768302df7fd4d Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sat, 13 Jul 2024 18:33:50 +0300 Subject: [PATCH 1/8] corrected hitbox updates after game unpause --- gameObject.cpp | 16 +++++++++++++--- unit.cpp | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gameObject.cpp b/gameObject.cpp index 145a9e7..d5c53e1 100644 --- a/gameObject.cpp +++ b/gameObject.cpp @@ -24,6 +24,12 @@ namespace battleship{ void GameObject::reinit(){ placeAt(pos); orientAt(rot); + + if(hitbox){ + Box *hbMesh = (Box*)hitbox->getMesh(0); + hbMesh->setSize(Vector3(width, height, length)); + hbMesh->updateVerts(hbMesh->getMeshBase()); + } } void GameObject::update(){ @@ -46,14 +52,18 @@ namespace battleship{ //TODO remove neccessity to create a material for an invisible mesh void GameObject::initHitbox(){ Box *box = new Box(Vector3(width, height, length)); - box->setMaterial(new Material(Root::getSingleton()->getLibPath() + "texture")); - box->setWireframe(false); + box->setWireframe(true); + + Material *mat = new Material(Root::getSingleton()->getLibPath() + "texture"); + mat->addBoolUniform("texturingEnabled", false); + mat->addVec4Uniform("diffuseColor", Vector4(1, 1, 1, 1)); + box->setMaterial(mat); sol::table gameObjTable = generateView()[GameObject::getGameObjTableName()][id + 1]; sol::table offsetPosTable = gameObjTable["hitboxOffset"]; hitbox = new Node(Vector3(offsetPosTable["x"], offsetPosTable["y"], offsetPosTable["z"])); hitbox->attachMesh(box); - hitbox->setVisible(false); + hitbox->setVisible(true); model->attachChild(hitbox); } diff --git a/unit.cpp b/unit.cpp index 81d7e94..4c89ff6 100755 --- a/unit.cpp +++ b/unit.cpp @@ -288,7 +288,7 @@ namespace battleship{ Unit::Unit(Player *player, int id, Vector3 pos, Quaternion rot, State st) : GameObject(GameObject::Type::UNIT, id, player, pos, rot), state(st){ selectable = true; - initProperties(); + Unit::initProperties(); initModel(); initHitbox(); initSound(); @@ -426,7 +426,7 @@ namespace battleship{ destroyModel(); destroySound(); - initProperties(); + Unit::initProperties(); initModel(); initHitbox(); From 4cdcc6bd618076738c13591c99d66fbc5038f94c Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 14 Jul 2024 15:34:44 +0300 Subject: [PATCH 2/8] implemented algorithm to detect point position relative to edges --- Assets/Scripts/GameObjects/Units/unitData.lua | 8 +- activeGameState.cpp | 117 +++++++++++++----- activeGameState.h | 3 +- gameObject.cpp | 44 ------- gameObject.h | 3 - 5 files changed, 95 insertions(+), 80 deletions(-) diff --git a/Assets/Scripts/GameObjects/Units/unitData.lua b/Assets/Scripts/GameObjects/Units/unitData.lua index 24701de..888f9b1 100644 --- a/Assets/Scripts/GameObjects/Units/unitData.lua +++ b/Assets/Scripts/GameObjects/Units/unitData.lua @@ -128,8 +128,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2.9, y = 8.22, z = 2.42}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 6, y = 9.22, z = 2.42}, + hitboxOffset = {x = 0, y = 4.5, z = 0}, lineOfSight = 20, name = 'War mech', basePath = PATH .. vehiclePrefix .. 'WarMechs/', @@ -181,8 +181,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2.9, y = 8.22, z = 2.42}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 9.57, y = 7, z = 20.1}, + hitboxOffset = {x = 0, y = 3, z = 1.06}, lineOfSight = 25, name = 'Tank', basePath = PATH .. vehiclePrefix .. 'Tanks/', diff --git a/activeGameState.cpp b/activeGameState.cpp index 949df80..bdc3618 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -147,18 +148,18 @@ namespace battleship{ if(!isSelectionBox && leftMouseClicked && getTime() - lastLeftMouseClicked > 10) isSelectionBox = true; else if (isSelectionBox) - updateSelectionBox(); + updateDragBox(); dragboxNode->setVisible(isSelectionBox); updateGameObjHoveredOn(); vector selectedUnits = mainPlayer->getSelectedUnits(); + GameObjectFrameController *fc = GameObjectFrameController::getSingleton(); if(!selectingDestOrient && leftMouseClicked && !selectedUnits.empty() && getTime() - lastLeftMouseClicked > 100){ selectingDestOrient = true; - GameObjectFrameController *fc = GameObjectFrameController::getSingleton(); fc->setPlacingFrames(true); fc->setRotatingFrames(true); @@ -168,15 +169,13 @@ namespace battleship{ renderUnits(); + if(fc->isPlacingFrames()) + fc->update(); + CameraController *camCtr = CameraController::getSingleton(); if(!camCtr->isLookingAround()) camCtr->updateCameraPosition(); - - GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton(); - - if(ufCtr->isPlacingFrames()) - ufCtr->update(); } void ActiveGameState::updateGameObjHoveredOn(){ @@ -194,17 +193,11 @@ namespace battleship{ gameObjs.push_back((GameObject*)u); } - Vector2 cursorPos = getCursorPos(); - - for(GameObject *gameObj : gameObjs){ - Vector2 rectSize = gameObj->calculateSelectionRect(); - Vector2 screenPos = gameObj->getScreenPos(); - - if(fabs(cursorPos.x - screenPos.x) < .5 * rectSize.x && fabs(cursorPos.y - screenPos.y) < .5 * rectSize.y){ + for(GameObject *gameObj : gameObjs) + if(isGameObjSelectable(gameObj, false)){ gameObjHoveredOn = gameObj; return; } - } gameObjHoveredOn = nullptr; } @@ -229,6 +222,74 @@ namespace battleship{ return false; } + bool ActiveGameState::isGameObjSelectable(GameObject *obj, bool useDragBox){ + Node *hitboxNode = obj->getHitbox(); + Box *hitbox = (Box*)hitboxNode->getMesh(0); + + Vector3 hitboxSize = hitbox->getSize(); + float width = hitboxSize.x, height = hitboxSize.y, length = hitboxSize.z; + + Vector3 corners[8]{ + Vector3(-.5 * width, -.5 * height, -.5 * length), + Vector3(-.5 * width, -.5 * height, .5 * length), + Vector3(.5 * width, -.5 * height, .5 * length), + Vector3(.5 * width, -.5 * height, -.5 * length), + Vector3(-.5 * width, .5 * height, -.5 * length), + Vector3(-.5 * width, .5 * height, .5 * length), + Vector3(.5 * width, .5 * height, .5 * length), + Vector3(.5 * width, .5 * height, -.5 * length), + }; + + vector cornersOnScreen; + Vector3 hitboxOffset = hitboxNode->getPosition(); + + for(int i = 0; i < 8; i++){ + Vector3 cornerInWorld = + obj->getPos() + + obj->getLeftVec() * (corners[i].x + hitboxOffset.x) + + obj->getUpVec() * (corners[i].y + hitboxOffset.y) + + obj->getDirVec() * (corners[i].z + hitboxOffset.z); + + cornersOnScreen.push_back(spaceToScreen(cornerInWorld)); + } + + vector selectionPoints; + + if(useDragBox){ + Vector3 dragboxOrigin = dragboxNode->getPosition(); + Vector3 dragboxSize = ((Quad*)dragboxNode->getMesh(0))->getSize(); + selectionPoints = vector{ + Vector2(dragboxOrigin.x, dragboxOrigin.y), + Vector2(dragboxOrigin.x + dragboxSize.x, dragboxOrigin.y), + Vector2(dragboxOrigin.x, dragboxOrigin.y + dragboxSize.y), + Vector2(dragboxOrigin.x + dragboxSize.x, dragboxOrigin.y + dragboxSize.y), + }; + } + else + selectionPoints = vector{getCursorPos()}; + + int edges[12][2]{{0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; + int numAboveEdges = 0, numBelowEdges = 0; + + for(int i = 0; i < selectionPoints.size() && numAboveEdges == 0 && numBelowEdges == 0; i++){ + for(int j = 0; j < 12; j++){ + Vector2 vertA = cornersOnScreen[edges[j][0]], vertB = cornersOnScreen[edges[j][1]]; + float edgeHorLen = fabs(vertA.x - vertB.x), edgeVertLen = fabs(vertA.y - vertB.y); + + if(fabs(selectionPoints[i].x - vertA.x) < edgeHorLen && fabs(selectionPoints[i].x - vertB.x) < edgeHorLen){ + if(vertA.x > selectionPoints[i].x) swap(vertA, vertB); + + float horOffset = (selectionPoints[i].x - vertA.x) / edgeHorLen; + float height = vertA.y + horOffset * edgeVertLen; + + (selectionPoints[i].y > height ? numAboveEdges : numBelowEdges)++; + } + } + } + + return (numAboveEdges > 0 && numBelowEdges > 0); + } + //TODO fix fog of war for hostile units void ActiveGameState::renderUnits() { vector units; @@ -264,7 +325,7 @@ namespace battleship{ unitGuiScreen = guiScreen; } - if(isSelectionBox && fabs(pos.x - dragboxOrigin.x) < .5 * dragboxSize.x && fabs(pos.y - dragboxOrigin.y) < .5 * dragboxSize.y){ + if(isSelectionBox && isGameObjSelectable(u, true)){ vector selectedUnits = mainPlayer->getSelectedUnits(); if(find(selectedUnits.begin(), selectedUnits.end(), u) == selectedUnits.end()){ @@ -302,31 +363,31 @@ namespace battleship{ return inside; } - void ActiveGameState::updateSelectionBox() { - Vector2 mousePos = getCursorPos(), selectionBoxOrigin, selectionBoxEnd; + void ActiveGameState::updateDragBox() { + Vector2 mousePos = getCursorPos(), dragBoxOrigin, dragBoxEnd; if (mousePos.x >= clickPoint.x && mousePos.y >= clickPoint.y) { - selectionBoxOrigin = Vector2(clickPoint.x, clickPoint.y); - selectionBoxEnd = Vector2(mousePos.x, mousePos.y); + dragBoxOrigin = Vector2(clickPoint.x, clickPoint.y); + dragBoxEnd = Vector2(mousePos.x, mousePos.y); } else if (mousePos.x < clickPoint.x && mousePos.y > clickPoint.y) { - selectionBoxOrigin = Vector2(mousePos.x, clickPoint.y); - selectionBoxEnd = Vector2(clickPoint.x, mousePos.y); + dragBoxOrigin = Vector2(mousePos.x, clickPoint.y); + dragBoxEnd = Vector2(clickPoint.x, mousePos.y); } else if (mousePos.x >= clickPoint.x && mousePos.y < clickPoint.y) { - selectionBoxOrigin = Vector2(clickPoint.x, mousePos.y); - selectionBoxEnd = Vector2(mousePos.x, clickPoint.y); + dragBoxOrigin = Vector2(clickPoint.x, mousePos.y); + dragBoxEnd = Vector2(mousePos.x, clickPoint.y); } else { - selectionBoxOrigin = Vector2(mousePos.x, mousePos.y); - selectionBoxEnd = Vector2(clickPoint.x, clickPoint.y); + dragBoxOrigin = Vector2(mousePos.x, mousePos.y); + dragBoxEnd = Vector2(clickPoint.x, clickPoint.y); } - Vector3 size = Vector3(selectionBoxEnd.x - selectionBoxOrigin.x, selectionBoxEnd.y - selectionBoxOrigin.y, 0); + Vector3 size = Vector3(dragBoxEnd.x - dragBoxOrigin.x, dragBoxEnd.y - dragBoxOrigin.y, 0); Quad *dragbox = (Quad*)dragboxNode->getMesh(0); dragbox->setSize(size); dragbox->updateVerts(dragbox->getMeshBase()); - dragboxNode->setPosition(Vector3(selectionBoxOrigin.x, selectionBoxOrigin.y, 0)); + dragboxNode->setPosition(Vector3(dragBoxEnd.x, dragBoxOrigin.y, 0)); } //TODO fix ejectable unit selection with multiple transports selected diff --git a/activeGameState.h b/activeGameState.h index 105c72e..9036086 100755 --- a/activeGameState.h +++ b/activeGameState.h @@ -46,9 +46,10 @@ namespace battleship{ void updateCursor(); void initDragbox(); void removeDragbox(); + bool isGameObjSelectable(GameObject*, bool); void deselectUnits(); void renderUnits(); - void updateSelectionBox(); + void updateDragBox(); void updateStructureFrames(); void castRayToTerrain(); void issueOrder(Order::TYPE, std::vector, bool); diff --git a/gameObject.cpp b/gameObject.cpp index d5c53e1..4083569 100644 --- a/gameObject.cpp +++ b/gameObject.cpp @@ -167,50 +167,6 @@ namespace battleship{ } } - int GameObject::sortCorners(vector &cornersOnScreen, bool vertical, bool max){ - const int NUM_CORNERS = cornersOnScreen.size(); - int ans = 0; - - for(int i = 0; i < NUM_CORNERS; i++){ - if(vertical && ((max && cornersOnScreen[ans].y < cornersOnScreen[i].y) || (!max && cornersOnScreen[ans].y > cornersOnScreen[i].y))) - ans = i; - else if(!vertical && ((max && cornersOnScreen[ans].x < cornersOnScreen[i].x) || (!max && cornersOnScreen[ans].x > cornersOnScreen[i].x))) - ans = i; - } - - return ans; - } - - Vector2 GameObject::calculateSelectionRect(){ - const int NUM_CORNERS = 8; - Vector3 corners[NUM_CORNERS]{ - Vector3(-.5 * width, -.5 * height, -.5 * length), - Vector3(-.5 * width, -.5 * height, .5 * length), - Vector3(.5 * width, -.5 * height, .5 * length), - Vector3(.5 * width, -.5 * height, -.5 * length), - Vector3(-.5 * width, .5 * height, -.5 * length), - Vector3(-.5 * width, .5 * height, .5 * length), - Vector3(.5 * width, .5 * height, .5 * length), - Vector3(.5 * width, .5 * height, -.5 * length) - }; - - vector cornersOnScreen; - - for(int i = 0; i < NUM_CORNERS; i++){ - Vector3 cornerInWorld = leftVec * corners[i].x + upVec * corners[i].y + dirVec * corners[i].z; - cornersOnScreen.push_back(spaceToScreen(cornerInWorld)); - } - - int leftMostPointId = sortCorners(cornersOnScreen, false, false); - int rightMostPointId = sortCorners(cornersOnScreen, false, true); - int topMostPointId = sortCorners(cornersOnScreen, true, false); - int bottomMostPointId = sortCorners(cornersOnScreen, true, true); - - float sizeX = cornersOnScreen[rightMostPointId].x - cornersOnScreen[leftMostPointId].x; - float sizeY = cornersOnScreen[bottomMostPointId].y - cornersOnScreen[topMostPointId].y; - return Vector2(sizeX, sizeY); - } - void GameObject::updateGameStats(Unit *targetUnit){ if(targetUnit->getHealth() <= targetUnit->getDeathHp()){ Player *targUnitPlayer = targetUnit->getPlayer(); diff --git a/gameObject.h b/gameObject.h index 62611f4..2bb7ba1 100644 --- a/gameObject.h +++ b/gameObject.h @@ -26,7 +26,6 @@ namespace battleship{ void placeAt(vb01::Vector3); void orientAt(vb01::Quaternion); std::string getGameObjTableName(); - vb01::Vector2 calculateSelectionRect(); void updateGameStats(Unit*); static sf::Sound* prepareSfx(sf::SoundBuffer*, std::string); inline vb01::Vector2 getScreenPos(){return screenPos;} @@ -49,8 +48,6 @@ namespace battleship{ inline Type getType(){return type;} inline vb01::Node* getHitbox(){return hitbox;} inline bool isRemove(){return remove;} - private: - int sortCorners(std::vector&, bool, bool); protected: virtual void initProperties(); virtual void destroyModel(); From aeb669f47e53658c933cb088e2bf1006ac1275ee Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 14 Jul 2024 16:43:00 +0300 Subject: [PATCH 3/8] corrected usage of height offsets --- activeGameState.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/activeGameState.cpp b/activeGameState.cpp index bdc3618..cdb53ae 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -271,8 +271,8 @@ namespace battleship{ int edges[12][2]{{0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; int numAboveEdges = 0, numBelowEdges = 0; - for(int i = 0; i < selectionPoints.size() && numAboveEdges == 0 && numBelowEdges == 0; i++){ - for(int j = 0; j < 12; j++){ + for(int i = 0; i < selectionPoints.size(); i++){ + for(int j = 0; j < 12 && (numAboveEdges == 0 || numBelowEdges == 0); j++){ Vector2 vertA = cornersOnScreen[edges[j][0]], vertB = cornersOnScreen[edges[j][1]]; float edgeHorLen = fabs(vertA.x - vertB.x), edgeVertLen = fabs(vertA.y - vertB.y); @@ -280,7 +280,7 @@ namespace battleship{ if(vertA.x > selectionPoints[i].x) swap(vertA, vertB); float horOffset = (selectionPoints[i].x - vertA.x) / edgeHorLen; - float height = vertA.y + horOffset * edgeVertLen; + float height = vertA.y + (vertA.y < vertB.y ? 1 : -1) * horOffset * edgeVertLen; (selectionPoints[i].y > height ? numAboveEdges : numBelowEdges)++; } @@ -311,7 +311,6 @@ namespace battleship{ guiManager->getText("research") }; vector selUnits = mainPlayer->getSelectedUnits(); - for (Unit *u : units) { if (u->getPlayer() == mainPlayer){ @@ -326,12 +325,11 @@ namespace battleship{ } if(isSelectionBox && isGameObjSelectable(u, true)){ + if(!shiftPressed) deselectUnits(); + vector selectedUnits = mainPlayer->getSelectedUnits(); if(find(selectedUnits.begin(), selectedUnits.end(), u) == selectedUnits.end()){ - if(!shiftPressed) - deselectUnits(); - mainPlayer->selectUnit(u); u->select(); } From ef541e4ef68cb34fc0eb8cdac7133261aad88ce6 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Mon, 15 Jul 2024 20:48:41 +0300 Subject: [PATCH 4/8] improved selection via dragbox --- activeGameState.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/activeGameState.cpp b/activeGameState.cpp index cdb53ae..77fe19e 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -228,8 +228,9 @@ namespace battleship{ Vector3 hitboxSize = hitbox->getSize(); float width = hitboxSize.x, height = hitboxSize.y, length = hitboxSize.z; + const int NUM_CORNERS = 8; - Vector3 corners[8]{ + Vector3 corners[NUM_CORNERS]{ Vector3(-.5 * width, -.5 * height, -.5 * length), Vector3(-.5 * width, -.5 * height, .5 * length), Vector3(.5 * width, -.5 * height, .5 * length), @@ -240,39 +241,50 @@ namespace battleship{ Vector3(.5 * width, .5 * height, -.5 * length), }; - vector cornersOnScreen; + Vector2 cornersOnScreen[NUM_CORNERS]; Vector3 hitboxOffset = hitboxNode->getPosition(); - for(int i = 0; i < 8; i++){ + for(int i = 0; i < NUM_CORNERS; i++){ Vector3 cornerInWorld = obj->getPos() + obj->getLeftVec() * (corners[i].x + hitboxOffset.x) + obj->getUpVec() * (corners[i].y + hitboxOffset.y) + obj->getDirVec() * (corners[i].z + hitboxOffset.z); - cornersOnScreen.push_back(spaceToScreen(cornerInWorld)); + cornersOnScreen[i] = spaceToScreen(cornerInWorld); } vector selectionPoints; + Vector3 dragboxOrigin = Vector3::VEC_ZERO, dragboxSize = Vector3::VEC_ZERO; if(useDragBox){ - Vector3 dragboxOrigin = dragboxNode->getPosition(); - Vector3 dragboxSize = ((Quad*)dragboxNode->getMesh(0))->getSize(); + dragboxOrigin = dragboxNode->getPosition(); + dragboxSize = ((Quad*)dragboxNode->getMesh(0))->getSize(); + Vector2 objScreenPos = spaceToScreen(obj->getPos()); + + if( + (dragboxOrigin.x < objScreenPos.x && objScreenPos.x < dragboxOrigin.x + dragboxSize.x) && + (dragboxOrigin.y < objScreenPos.y && objScreenPos.y < dragboxOrigin.y + dragboxSize.y) + ) + return true; + selectionPoints = vector{ Vector2(dragboxOrigin.x, dragboxOrigin.y), Vector2(dragboxOrigin.x + dragboxSize.x, dragboxOrigin.y), - Vector2(dragboxOrigin.x, dragboxOrigin.y + dragboxSize.y), Vector2(dragboxOrigin.x + dragboxSize.x, dragboxOrigin.y + dragboxSize.y), + Vector2(dragboxOrigin.x, dragboxOrigin.y + dragboxSize.y) }; } else selectionPoints = vector{getCursorPos()}; - int edges[12][2]{{0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; int numAboveEdges = 0, numBelowEdges = 0; for(int i = 0; i < selectionPoints.size(); i++){ - for(int j = 0; j < 12 && (numAboveEdges == 0 || numBelowEdges == 0); j++){ + const int NUM_EDGES = 12; + int edges[NUM_EDGES][2]{{0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; + + for(int j = 0; j < NUM_EDGES && (numAboveEdges == 0 || numBelowEdges == 0); j++){ Vector2 vertA = cornersOnScreen[edges[j][0]], vertB = cornersOnScreen[edges[j][1]]; float edgeHorLen = fabs(vertA.x - vertB.x), edgeVertLen = fabs(vertA.y - vertB.y); @@ -314,8 +326,6 @@ namespace battleship{ for (Unit *u : units) { if (u->getPlayer() == mainPlayer){ - Vector3 dragboxSize = ((Quad*)dragboxNode->getMesh(0))->getSize(); - Vector3 dragboxOrigin = dragboxNode->getPosition(), dragboxEnd = dragboxOrigin + dragboxSize; Vector2 pos = u->getScreenPos(); string guiScreen = u->getGuiScreen(); @@ -385,7 +395,7 @@ namespace battleship{ Quad *dragbox = (Quad*)dragboxNode->getMesh(0); dragbox->setSize(size); dragbox->updateVerts(dragbox->getMeshBase()); - dragboxNode->setPosition(Vector3(dragBoxEnd.x, dragBoxOrigin.y, 0)); + dragboxNode->setPosition(Vector3(dragBoxOrigin.x, dragBoxOrigin.y, 0)); } //TODO fix ejectable unit selection with multiple transports selected @@ -532,7 +542,11 @@ namespace battleship{ } selectingDestOrient = false; + isSelectionBox = false; + Quad *quad = (Quad*)dragboxNode->getMesh(0); + quad->setSize(Vector3::VEC_ZERO); + quad->updateVerts(quad->getMeshBase()); ufCtr->setPlacingFrames(false); ufCtr->setRotatingFrames(false); From 200c30664bfcf452618b4e244a73b8ea50dc7a97 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Tue, 16 Jul 2024 19:42:21 +0300 Subject: [PATCH 5/8] bugfix to allow either to give units orders or select via dragbox --- activeGameState.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/activeGameState.cpp b/activeGameState.cpp index 77fe19e..c21e054 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -144,8 +144,11 @@ namespace battleship{ guiManager->getText("research")->setText(to_wstring(mainPlayer->getResource(ResourceType::RESEARCH))); updateCursor(); + Vector2 cursorPos = getCursorPos(); - if(!isSelectionBox && leftMouseClicked && getTime() - lastLeftMouseClicked > 10) + float eps = .01; + + if(!isSelectionBox && leftMouseClicked && (fabs(clickPoint.x - cursorPos.x) > eps || fabs(clickPoint.y - cursorPos.y) > eps) && getTime() - lastLeftMouseClicked > 10) isSelectionBox = true; else if (isSelectionBox) updateDragBox(); @@ -333,17 +336,6 @@ namespace battleship{ guiManager->readLuaScreenScript(u->getGuiScreen(), buttons, listboxes, checkboxes, sliders, textboxes, guiRects, texts); unitGuiScreen = guiScreen; } - - if(isSelectionBox && isGameObjSelectable(u, true)){ - if(!shiftPressed) deselectUnits(); - - vector selectedUnits = mainPlayer->getSelectedUnits(); - - if(find(selectedUnits.begin(), selectedUnits.end(), u) == selectedUnits.end()){ - mainPlayer->selectUnit(u); - u->select(); - } - } } else{ Vector3 rendUnPos = u->getPos(); @@ -467,7 +459,9 @@ namespace battleship{ lastLeftMouseClicked = getTime(); } else{ - if (mainPlayer->getNumSelectedUnits() > 0){ + int numSelectedUnits = mainPlayer->getNumSelectedUnits(); + + if(numSelectedUnits > 0){ if(selectingPatrolPoints){ castRayToTerrain(); @@ -482,7 +476,7 @@ namespace battleship{ issueOrder(type, targets, shiftPressed); } } - else{ + else if(!(selectingDestOrient || isSelectionBox)){ bool canSelect = canSelectHoveredOnGameObj(); bool ownGameObj = (gameObjHoveredOn && gameObjHoveredOn->getPlayer()->getTeam() == mainPlayer->getTeam()); @@ -532,17 +526,24 @@ namespace battleship{ } } } - else{ - if(canSelectHoveredOnGameObj()){ - if(!shiftPressed) - deselectUnits(); + else if(numSelectedUnits == 0 && canSelectHoveredOnGameObj()){ + if(!shiftPressed) deselectUnits(); - mainPlayer->selectUnit((Unit*)gameObjHoveredOn); - } + mainPlayer->selectUnit((Unit*)gameObjHoveredOn); } selectingDestOrient = false; + if(isSelectionBox){ + if(!shiftPressed) deselectUnits(); + + vector units = mainPlayer->getUnits(); + + for(Unit *un : units) + if(isGameObjSelectable(un, true)) + mainPlayer->selectUnit(un); + } + isSelectionBox = false; Quad *quad = (Quad*)dragboxNode->getMesh(0); quad->setSize(Vector3::VEC_ZERO); From feb64624ad440361fbf52deaece319c8e63f68a9 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 21 Jul 2024 14:28:26 +0300 Subject: [PATCH 6/8] updated unit selection boxes --- Assets/Scripts/GameObjects/Units/unitData.lua | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/Assets/Scripts/GameObjects/Units/unitData.lua b/Assets/Scripts/GameObjects/Units/unitData.lua index 888f9b1..7e1e7f8 100644 --- a/Assets/Scripts/GameObjects/Units/unitData.lua +++ b/Assets/Scripts/GameObjects/Units/unitData.lua @@ -233,8 +233,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2.9, y = 8.22, z = 2.42}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 6.8, y = 6.8, z = 15.2}, + hitboxOffset = {x = 0, y = 1, z = 0}, lineOfSight = 30, name = 'Artillery', basePath = PATH .. vehiclePrefix .. 'Artillery/', @@ -272,7 +272,7 @@ units = { buildTime = 1000, hackTime = 1000, cost = 500, - size = {x = 1, y = 8, z = 13.45}, + size = {x = 1, y = 8, z = 1}, hitboxOffset = {x = 0, y = 0, z = 0}, lineOfSight = 20, name = 'Engineer', @@ -297,7 +297,7 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, + size = {x = 21, y = 17.5, z = 56.6}, garrisonCapacity = {2, 2, 2}, hitboxOffset = {x = 0, y = 0, z = 0}, lineOfSight = 5, @@ -324,7 +324,7 @@ units = { buildTime = 1000, cost = 500, garrisonCapacity = {2, 2, 2}, - size = {x = 2, y = 8.25, z = 2}, + size = {x = 17.5, y = 16.5, z = 63.5}, hitboxOffset = {x = 0, y = 0, z = 0}, lineOfSight = 5, colorNodes = {'Cube.002'}, @@ -352,8 +352,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 3.29, y = 2.23, z = 9.5}, + hitboxOffset = {x = 0, y = .37, z = 0}, lineOfSight = 5, name = 'Cargo ship', colorNodes = {'CargoshipTemplateOBJ.001'}, @@ -403,8 +403,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 18.8, y = 17.5, z = 52.6}, + hitboxOffset = {x = 0, y = 1.9, z = 0}, lineOfSight = 5, colorNodes = {'tacticalCruiser.001'}, name = 'Tactical cruiser', @@ -454,8 +454,8 @@ units = { buildTime = 1000, cost = 500, garrisonCapacity = {2, 2, 2}, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 17, y = 17, z = 45.1}, + hitboxOffset = {x = 0, y = 3.78, z = 0}, lineOfSight = 5, colorNodes = {'defensiveCruiser.001'}, name = 'Defensive cruiser', @@ -504,8 +504,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 21.1, y = 18.1, z = 28.6}, + hitboxOffset = {x = 0, y = 4.19, z = 0}, lineOfSight = 5, colorNodes = {'cheapCruiser.001'}, name = 'Cheap cruiser', @@ -555,8 +555,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 17.9, y = 14.9, z = 45.6}, + hitboxOffset = {x = 0, y = 2.98, z = 1.21}, lineOfSight = 5, colorNodes = {'transportCruiser.001'}, name = 'Transport cruiser', @@ -604,8 +604,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 37.8, y = 16.7, z = 87}, + hitboxOffset = {x = 0, y = 6.38, z = 0}, lineOfSight = 5, name = 'Heavy carrier', colorNodes = {'heavyCarrier.001'}, @@ -668,8 +668,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 26, y = 21.1, z = 81.8}, + hitboxOffset = {x = 0, y = 4.13, z = 0}, lineOfSight = 5, name = 'Champion carrier', colorNodes = {'Models4.001'}, @@ -720,8 +720,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 8.25, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 14.1, y = 29.2, z = 59.5}, + hitboxOffset = {x = 0, y = 6.7, z = 0}, lineOfSight = 5, name = 'Missile submarine', basePath = PATH .. vehiclePrefix .. 'Submarines/', @@ -759,8 +759,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + hitboxOffset = {x = 0, y = 1.25, z = 0}, + size = {x = 10.7, y = 15.4, z = 50}, lineOfSight = 5, name = 'Stealth submarine', colorNodes = {'stealthSubmarine.001'}, @@ -788,8 +788,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 21.6, y = 11.9, z = 25.4}, + hitboxOffset = {x = 0, y = 1.02, z = .95}, lineOfSight = 5, colorNodes = {'Cube.001'}, name = 'Land factory', @@ -825,8 +825,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 8.53, y = 51.9, z = 8.53}, + hitboxOffset = {x = 0, y = .97, z = 0}, lineOfSight = 5, colorNodes = {'Cube.001'}, name = 'Trade center', @@ -844,8 +844,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 40, y = 26.2, z = 40}, + hitboxOffset = {x = 0, y = 1.08, z = 0}, lineOfSight = 5, generationRate = 100, generationSpeed = 10, @@ -906,8 +906,8 @@ units = { health = 500, buildTime = 1000, cost = 500, - size = {x = 2, y = 10, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 5, y = 8, z = 5}, + hitboxOffset = {x = 0, y = 4, z = 0}, lineOfSight = 55, name = 'Point defense', colorNodes = {'Hoses', 'Hoses.001'}, @@ -928,8 +928,8 @@ units = { drawSpeed = 5, cost = 500, colorNodes = {'Cube.001'}, - size = {x = 4, y = 1.15, z = 4}, - hitboxOffset = {x = 0, y = 0, z = 0}, + hitboxOffset = {x = 0, y = 1, z = 0}, + size = {x = 3.24, y = 3.38, z = 3.24}, lineOfSight = 5, name = 'Extractor', basePath = PATH .. structurePrefix .. 'Extractors/', @@ -946,8 +946,8 @@ units = { buildTime = 1000, cost = 500, colorNodes = {'Cube.001'}, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 15.1, y = 13.5, z = 25}, + hitboxOffset = {x = 0, y = 1.05, z = 1.85}, lineOfSight = 5, name = 'Refinery', basePath = PATH .. structurePrefix .. 'Refineries/', @@ -964,8 +964,8 @@ units = { health = 1000, buildTime = 1000, cost = 1000, - size = {x = 1, y = 1.15, z = 2}, - hitboxOffset = {x = 0, y = 0, z = 0}, + size = {x = 43.3, y = 50, z = 43.3}, + hitboxOffset = {x = 0, y = .8, z = 0}, lineOfSight = 5, name = 'Fort', basePath = PATH .. structurePrefix .. 'Forts/', From 3d7e579a983617ceebf6bdd6502485adb0798c6e Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 21 Jul 2024 14:37:52 +0300 Subject: [PATCH 7/8] updated test maps --- Assets/Models/Maps/111/111.lua | 21 ++++++++++++++------- Assets/Models/Maps/222/222.lua | 10 +++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Assets/Models/Maps/111/111.lua b/Assets/Models/Maps/111/111.lua index fbd8215..07f8284 100644 --- a/Assets/Models/Maps/111/111.lua +++ b/Assets/Models/Maps/111/111.lua @@ -14,15 +14,22 @@ players = { { resourceDeposits = {}, units = { - {id = UnitId.ENGINEER, pos = {x = 30.000000, y = 0.000000, z = 30.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.ENGINEER, pos = {x = 30.000000, y = 0.000000, z = 30.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.POINT_DEFENSE, pos = {x = 50.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, {id = UnitId.TANK, pos = {x = 40.000000, y = 0.000000, z = 30.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.WAR_MECH, pos = {x = 40.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.ARTILLERY, pos = {x = 30.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.TACTICAL_CRUISER, pos = {x = 5.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.CHEAP_CRUISER, pos = {x = -5.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.DEFENSIVE_CRUISER, pos = {x = 0.00000, y = 0.000000, z = 5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.TRANSPORT_CRUISER, pos = {x = 0.00000, y = 0.000000, z = -5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.CHAMPION_CARRIER, pos = {x = 0.00000, y = 0.000000, z = 15.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.HEAVY_CARRIER, pos = {x = 20.00000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.TRADE_CENTER, pos = {x = 10.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.SCOUT_TRANSPORT, pos = {x = 20.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.HOVER_TRANSPORT, pos = {x = 10.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.RESOURCE_ROVER, pos = {x = 0.000000, y = 0.000000, z = 40.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.TACTICAL_CRUISER, pos = {x = 5.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.CHEAP_CRUISER, pos = {x = -5.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.DEFENSIVE_CRUISER, pos = {x = 0.00000, y = 0.000000, z = 5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.TRANSPORT_CRUISER, pos = {x = 0.00000, y = 0.000000, z = -5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.CHAMPION_CARRIER, pos = {x = 0.00000, y = 0.000000, z = 15.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.HEAVY_CARRIER, pos = {x = 20.00000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + --{id = UnitId.STEALTH_SUBMARINE, pos = {x = 10.00000, y = 0.000000, z = 5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.MISSILE_SUBMARINE, pos = {x = 10.00000, y = 0.000000, z = -5.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, }, } diff --git a/Assets/Models/Maps/222/222.lua b/Assets/Models/Maps/222/222.lua index c2fc4c0..8d11f33 100644 --- a/Assets/Models/Maps/222/222.lua +++ b/Assets/Models/Maps/222/222.lua @@ -13,7 +13,7 @@ resourceDeposits = { {id = ResourceId.RESOURCE, pos = {x = 50, y = 0, z = 0}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, initAmmount = 30000}, }, units = { - {id = UnitId.ENGINEER, pos = {x = -50.000000, y = 0.000000, z = -50.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.TANK, pos = {x = -50.000000, y = 0.000000, z = -50.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, --{id = UnitId.ENGINEER, pos = {x = -10.000000, y = 0.000000, z = -10.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, --{id = UnitId.POINT_DEFENSE, pos = {x = 0.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, } @@ -22,12 +22,12 @@ units = { resourceDeposits = {}, units = { {id = UnitId.WAR_MECH, pos = {x = 3.000000, y = 0.000000, z = 12.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.WAR_MECH, pos = {x = 0.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, - {id = UnitId.TRADE_CENTER, pos = {x = 0.000000, y = 0.000000, z = 20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, - {id = UnitId.RESOURCE_ROVER, pos = {x = 4.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.TANK, pos = {x = 0.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.POINT_DEFENSE, pos = {x = 0.000000, y = 0.000000, z = 20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, + {id = UnitId.SCOUT_TRANSPORT, pos = {x = 4.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.ENGINEER, pos = {x = 45.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, --{id = UnitId.EXTRACTOR, pos = {x = 30.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, - {id = UnitId.FORT, pos = {x = 50.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, + {id = UnitId.LAB, pos = {x = 50.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, } } }, From 027dfc2071e65e77abdc25556b9a5e599f19fd7e Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 21 Jul 2024 14:45:23 +0300 Subject: [PATCH 8/8] quick fixes --- Assets/Models/Maps/222/222.lua | 4 ++-- Assets/Scripts/GameObjects/Units/unitData.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Models/Maps/222/222.lua b/Assets/Models/Maps/222/222.lua index 8d11f33..50da9ab 100644 --- a/Assets/Models/Maps/222/222.lua +++ b/Assets/Models/Maps/222/222.lua @@ -24,10 +24,10 @@ units = { {id = UnitId.WAR_MECH, pos = {x = 3.000000, y = 0.000000, z = 12.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.TANK, pos = {x = 0.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.POINT_DEFENSE, pos = {x = 0.000000, y = 0.000000, z = 20.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, - {id = UnitId.SCOUT_TRANSPORT, pos = {x = 4.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, + {id = UnitId.SCOUT_TRANSPORT, pos = {x = 40.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, {id = UnitId.ENGINEER, pos = {x = 45.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}}, --{id = UnitId.EXTRACTOR, pos = {x = 30.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, - {id = UnitId.LAB, pos = {x = 50.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, + --{id = UnitId.LAB, pos = {x = 50.000000, y = 0.000000, z = 0.000000}, rot = {w = 1.000000, x = 0.000000, y = 0.000000, z = 0.000000}, buildStatus = 100}, } } }, diff --git a/Assets/Scripts/GameObjects/Units/unitData.lua b/Assets/Scripts/GameObjects/Units/unitData.lua index 7e1e7f8..9a44810 100644 --- a/Assets/Scripts/GameObjects/Units/unitData.lua +++ b/Assets/Scripts/GameObjects/Units/unitData.lua @@ -845,7 +845,7 @@ units = { buildTime = 1000, cost = 500, size = {x = 40, y = 26.2, z = 40}, - hitboxOffset = {x = 0, y = 1.08, z = 0}, + hitboxOffset = {x = 0, y = 14, z = 0}, lineOfSight = 5, generationRate = 100, generationSpeed = 10,