From 155d8bff1bb992b5a305f03129361a86e57e5685 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 26 Jan 2016 13:36:30 -0600 Subject: [PATCH] Fix cannon angles --- .../mineplex/game/clans/clans/siege/cannon/Cannon.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java index b7788772d..865f7c2c4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java @@ -523,11 +523,15 @@ public class Cannon implements Listener ArmorStand armorStand = (ArmorStand) UtilMath.getFirst(_entities); double standYaw = Math.toDegrees(armorStand.getHeadPose().getY()) % 360; double riderYaw = _rider.getLocation().getYaw() % 360; - + + // riderYaw = 350 and standYaw = 20 + // dif should be -30 and not 330 double dif = riderYaw - standYaw; - + if (dif > 180) dif -= 360; + if (dif < -180) dif += 360; + double yaw = standYaw + Math.min(dif / 20.f, 5f); - + Location pos = armorStand.getLocation(); pos.setYaw((float) yaw);