From fc15e9310dadf7c124056a2f44d8a1bdb0441ea0 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 7 Nov 2023 13:44:29 -0500 Subject: [PATCH] Set offset and rotation from building --- src/engine/gameManager/BuildingManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 09b77ec4..40bc83a7 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -986,10 +986,14 @@ public enum BuildingManager { Path2D.Float stencilPath = new Path2D.Float(); - // Add building offset to vertices + // Add building offset and rotation to vertices - for (Vector2f vertex : meshEntry) + for (Vector2f vertex : meshEntry) { vertex.addLocal(building.getLoc().x, building.getLoc().y); + Vector3fImmutable rotatedPoint = new Vector3fImmutable(vertex.x, 0, vertex.y); + rotatedPoint = Vector3fImmutable.rotateAroundPoint(building.getLoc(), rotatedPoint, building.getBounds().getQuaternion().angleY); + vertex.set(rotatedPoint.x, rotatedPoint.z); + } // Move to start of path