From 48172fb220d0b5addf3bbb1b43c449a9f1526a0c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 2 May 2023 08:26:43 -0400 Subject: [PATCH] Rotation slot location by building rotation. --- src/engine/objects/Mob.java | 10 ++++++++-- src/engine/objects/NPC.java | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index bfc60eca..60d8b5fb 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -917,8 +917,14 @@ public class Mob extends AbstractIntelligenceAgent { slotLocation = BuildingManager.getSlotLocation(building, slot); this.bindLoc = building.getLoc().add(slotLocation); - this.loc = building.getLoc().add(slotLocation); - this.endLoc = bindLoc; + + // Rotate slot position by the building rotation + + Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); + + this.loc = new Vector3fImmutable(bindLoc); + this.endLoc = new Vector3fImmutable(bindLoc); + ; } diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 40db0b76..1ec3ecaf 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -361,7 +361,12 @@ public class NPC extends AbstractCharacter { slotLocation = BuildingManager.getSlotLocation(building, slot); this.bindLoc = building.getLoc().add(slotLocation); - this.loc = building.getLoc().add(slotLocation); + + // Rotate slot position by the building rotation + + Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); + + this.loc = new Vector3fImmutable(bindLoc); // Configure region and floor/level for this NPC