i really need help with figuring out a velocity equation to launch a player from one X Y Z location to another. from looking at other threads i created the following code (the code doesn't work)
public void vJump(Entity entity, Location loc, double time)
{
this.entity = entity;
entity.setVelocity(getV(entity.getLocation(), loc, time));
}
private Vector getV(Location p1, Location p2, double t)
{
double x = p2.getX() - p1.getX();
double y = p2.getY() - p1.getY();
double z = p2.getZ() - p1.getZ();
double gravity = -14.266;
return new Vector(getVelocity(x,gravity,t), getVelocity(y,gravity,t), getVelocity(z,gravity,t));
}
private double getVelocity(double d, double a, double t)
{
a*=-.5;
a*=Math.pow(t,2);
d-=a;
return d/t;
}
i do not know the gravity in Minecraft nor do i know the movement friction. the problem with the code above is that it doesn't go in the right direction nor does it create the parabola effect i was looking for.