From 52160d48c4414407ba3e35e252aa882f946fb5cb Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 2 May 2023 13:17:34 -0400 Subject: [PATCH] Adding building rotation to mobile rotation. --- src/engine/objects/Mob.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index ea8d1f95..d7f98359 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -41,6 +41,7 @@ import java.util.HashSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantReadWriteLock; +import static engine.math.FastMath.acos; import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; public class Mob extends AbstractIntelligenceAgent { @@ -928,6 +929,12 @@ public class Mob extends AbstractIntelligenceAgent { this.loc = new Vector3fImmutable(bindLoc); this.endLoc = new Vector3fImmutable(bindLoc); + // Rotate mobile's rotation by the building's rotation + + slotRotation = new Quaternion().fromAngles(0, acos(this.getRot().y), 0); + slotRotation = slotRotation.mult(building.getBounds().getQuaternion()); + this.setRot(new Vector3f(0, slotRotation.y, 0)); + // Configure building region and floor/level for this Mobile this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);