Movement event

Discussion in 'Spigot Plugin Development' started by coolnickname, May 15, 2015.

  1. Hello, I got myself a nice playerMovement event, but I only need it to trigger if the player is pressing W. And I need to stop the player from looking around (That means he may only look in around in 80 dergrees) is that event possible?
     
  2. You can possibly do both with a change of yaw. Check of it and cancel the movement if it happens. With regards to W move: possibly get the players line of sight and locations in front of him, if he doesn't move in that direction cancel the action.
     
  3. Thanks. i'll try that!
     
  4. To see if a player is moving forward simply check if the angle between the player's view direction and movement direction is less than Math.PI/2. If it is, then the player is moving forward.