Fixed Sponge implementation player rotations

Dieser Commit ist enthalten in:
Wyatt Childers 2016-03-03 20:31:44 -05:00
Ursprung f09fff9491
Commit 222ba33aa4
2 geänderte Dateien mit 4 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -35,8 +35,7 @@ final class SpongeAdapter {
public static Location adapt(org.spongepowered.api.world.Location<org.spongepowered.api.world.World> loc, Vector3d rot) { public static Location adapt(org.spongepowered.api.world.Location<org.spongepowered.api.world.World> loc, Vector3d rot) {
Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ()); Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ());
Vector dir = new Vector(rot.getX(), rot.getY(), rot.getZ());
return new Location(SpongeAdapter.adapt(loc.getExtent()), position, dir); return new Location(SpongeAdapter.adapt(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX());
} }
} }

Datei anzeigen

@ -148,16 +148,12 @@ public class SpongePlayer extends AbstractPlayerActor {
this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ() this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ()
); );
double yawR = Math.toRadians(yaw);
double pitchR = Math.toRadians(pitch);
double xz = Math.cos(pitch);
this.player.setLocationAndRotation( this.player.setLocationAndRotation(
loc, loc,
new Vector3d( new Vector3d(
-xz * Math.sin(yawR), pitch,
-Math.sin(pitchR), yaw,
xz * Math.cos(yawR) 0
) )
); );
} }