Skip to content

Commit

Permalink
Fix ceiling->ceiling teleportation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jul 11, 2023
1 parent a482a66 commit b01c1e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/fusionflux/portalcubed/PortalCubed.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static TeleportResult commonTeleport(
}
IPQuaternion immediateFinalRot = oldCameraRotation.hamiltonProduct(portalTransform.getConjugated());
final Vector3d euler = immediateFinalRot.toQuaterniond().getEulerAnglesZXY(new Vector3d());
final float finalYaw = (float)Math.toDegrees(euler.y) + 180;
float finalYaw = (float)Math.toDegrees(euler.y) + 180;
float finalPitch = (float)Math.toDegrees(euler.x);

if (entity instanceof Player) {
Expand All @@ -368,7 +368,11 @@ public static TeleportResult commonTeleport(
tweak = true;
}
if (tweak) {
immediateFinalRot = immediateFinalRot.hamiltonProduct(IPQuaternion.rotationByDegrees(new Vec3(0, 1, 0), 180));
if (portal.getNormal().y > 0 && otherNormal.y > 0) {
immediateFinalRot = immediateFinalRot.hamiltonProduct(IPQuaternion.rotationByDegrees(new Vec3(0, 1, 0), 180));
} else {
finalYaw -= 180;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ private void performTeleport(
),
0
);
teleportOffsetNoRotate = teleportOffsetNoRotate.add(0, -thisEntity.getEyeHeight(), 0);
if (portal.getOtherNormal().get().y > -1e-7) {
teleportOffsetNoRotate = teleportOffsetNoRotate.add(0, -thisEntity.getEyeHeight(), 0);
}
} else if (portal.getNormal().y > 0 && portal.getOtherNormal().get().y > 0) {
teleportOffset = teleportOffset.add(0, thisEntity.getEyeHeight(), 0);
}
Expand Down

0 comments on commit b01c1e3

Please sign in to comment.