From b7c2e09b81e2742ba6b757eabfc6d82224192d17 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 2 May 2023 08:39:03 -0400 Subject: [PATCH] Rotation slot location by building rotation. --- src/engine/objects/Mob.java | 13 +++++-------- src/engine/objects/NPC.java | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 60d8b5fb..8c8d06d6 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -896,8 +896,6 @@ public class Mob extends AbstractIntelligenceAgent { this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon); this.bindLoc = this.building.getLoc().add(this.bindLoc); - this.loc = new Vector3fImmutable(bindLoc); - this.endLoc = new Vector3fImmutable(bindLoc); } else { @@ -918,15 +916,14 @@ public class Mob extends AbstractIntelligenceAgent { this.bindLoc = building.getLoc().add(slotLocation); - // Rotate slot position by the building rotation + } - Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); + // Rotate slot position by the building rotation - this.loc = new Vector3fImmutable(bindLoc); - this.endLoc = new Vector3fImmutable(bindLoc); - ; + this.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); - } + this.loc = new Vector3fImmutable(bindLoc); + this.endLoc = new Vector3fImmutable(bindLoc); // Configure building region and floor/level for this Mobile diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 1ec3ecaf..bb8ffb81 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -364,7 +364,7 @@ public class NPC extends AbstractCharacter { // Rotate slot position by the building rotation - Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); + this.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), this.bindLoc, -building.getBounds().getQuaternion().angleY); this.loc = new Vector3fImmutable(bindLoc);