Browse Source

Adding building rotation to mobile rotation.

master
MagicBot 2 years ago
parent
commit
52160d48c4
  1. 7
      src/engine/objects/Mob.java

7
src/engine/objects/Mob.java

@ -41,6 +41,7 @@ import java.util.HashSet; @@ -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 { @@ -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);

Loading…
Cancel
Save