Trajectory

Discussion in 'Plugin Development' started by BlueMustache, Mar 2, 2014.

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

    BlueMustache

    Hello,
    How might I go about the following?

    I call my function calcVelocity();

    The functions inputs are

    public void calcVelocity(Location from, Location to) {
    //pseudocode
    return velocity;
    }

    I want to input a Location "from" and a destination "to", and get the velocity that I need to set the entity to, to move from point A to point B. I have no higher math skills than Algebra. Can someone help me?

    Thanks!
     
  2. Offline

    NathanWolf

    I think this is going to involve physics, not so much math :)

    You could start with the vector between the two points (e.g. Vector delta = from.toVector().subtract(to.toVector)), and see how well that works, tweak from there. Keep in mind the server will smack down velocities that it considers too high.

    You'll probably need to adjust y to account for gravity, as well- you basically need to make a vector that will result in an arc (once gravity is included) that ends at the target block.

    You're best bet may be to just play with it and tweak until it seems to work ok. Otherwise someone else may know the formula for this, but it seems kinda non-trivial.
     
  3. Offline

    BlueMustache


    Thanks.
    If anyone else has a formula feel free to contribute.

    This really didn't help.
    Anyone got another idea?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
    NathanWolf likes this.
Thread Status:
Not open for further replies.

Share This Page