I have one certain position. The other position is the position of the player. When the player is doing something i want to knock him to the other direction as the direction of the certain position. I hope the drawing can help.
You want to go the opposite of the vector between the your position and position1, so you get the vector between you and position 1, then just reverse it, multiply it, and apply it to the player. Edit : I recommend looking at this if you get lost - https://bukkit.org/threads/tutorial-how-to-calculate-vectors.138849/ Specifically section 4.2
@Domeax 1. Take player's position, and subtract from it the position you'd like to move away from 2. Normalise the resultant vector 3. Multiply it by the speed you'd like the player to have 4. Set the player's velocity to this.
@Domeax Try this: Code: PLAYER.setVelocity(LOCATION.toVector().subtract(PLAYER.getLocation().toVector()).normalize().multiply(STRENGTH)); It should send the player towards the specified location while strength is simply how fast the initial push will be.