Guest User

Untitled

a guest
Oct 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. // Drops me to ground
  2. Vector playerVector = player.getVelocity();
  3. Vector eyeDirection = player.getLocation().getDirection().setY(0).normalize();
  4. Double velocityInDirection = playerVector.dot(eyeDirection);
  5. Vector directionVector = playerVector.subtract(eyeDirection.multiply(velocityInDirection));
  6. player.setVelocity(directionVector);
  7.  
  8.  
  9. // Doesn't drop me to ground
  10. Vector playerVector = player.getVelocity();
  11. Vector eyeDirection = player.getLocation().getDirection().setY(0).normalize();
  12. Double velocityInDirection = playerVector.dot(eyeDirection);
  13. Vector directionVector = eyeDirection.multiply(velocityInDirection);
  14. player.setVelocity(directionVector);
Add Comment
Please, Sign In to add comment