Fixed Sponge implementation player rotations

This commit is contained in:
Wyatt Childers 2016-03-03 20:31:44 -05:00
parent f09fff9491
commit 222ba33aa4
2 changed files with 4 additions and 9 deletions

View File

@ -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());
} }
} }

View File

@ -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
) )
); );
} }