How to increase the velocity of a projectile without messing up its trajectory

Discussion in 'Plugin Development' started by jstN0body, Mar 29, 2020.

Thread Status:
Not open for further replies.
  1. Offline


    basically when I multiply the vector of the velocity of a projectile in my code it makes it fire slightly lower and to the right of the crosshair does anyone know a way to fix this?
            double velocityX = player.getLocation().getDirection().getX();
            double velocityY = player.getLocation().getDirection().getY();
            double velocityZ = player.getLocation().getDirection().getZ();
            Vector velocityXYZ = new Vector(velocityX, velocityY, velocityZ);
            Vector velocity = velocityXYZ.multiply(2.5);
  2. Offline


    If the projectile already exists, you can get its velocity and multiply that. If you are spawning the projectile and then firing it yourself, you could try getting the player's eye location. I know that the getLocation() you are using points to the player's feet, and I am not sure how getDirection() is calculated from their feet.
Thread Status:
Not open for further replies.

Share This Page