Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.iws
.gradle
.run
build/

# Eclipse
.settings/
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/goldenshadow/displayentityeditor/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,10 @@ public static void rotateGroup(Collection<Display> displays, Location pivot, flo
loc.setY(pivot.getY() + newY);
loc.setZ(pivot.getZ() + newZ);

// Update orientation correctly for all orientations
org.bukkit.util.Vector dir = loc.getDirection();
double dx = dir.getX(), dy = dir.getY(), dz = dir.getZ();
double dDot = dx * axisX + dz * axisZ;
double dCrossX = -dy * axisZ;
double dCrossY = dx * axisZ - dz * axisX;
double dCrossZ = dy * axisX;

double newDx = dx * cos + dCrossX * sin + axisX * dDot * (1 - cos);
double newDy = dy * cos + dCrossY * sin;
double newDz = dz * cos + dCrossZ * sin + axisZ * dDot * (1 - cos);
loc.setDirection(new org.bukkit.util.Vector(newDx, newDy, newDz));
// Apply the configured pitch step directly. Rotating the direction vector around
// the player's view axis makes the result depend on the display's current yaw
// and can also change its yaw unexpectedly. Minecraft limits pitch to +/-90°.
loc.setPitch(Location.normalizePitch(loc.getPitch() + angle));
}
d.teleport(loc);
}
Expand Down
Loading