# Points in trajectory

Im creating a game, in which you can throw a ball. The ball is fired at a set angle, and then the velocity of the ball is set with this function: (Its copy pasted from another question in here, so in not 100% on the math)

function BallisticVel(target: Vector3, angle: float): Vector3
{
var dir = target - transform.position; // get target direction
var h = dir.y; // get height difference
dir.y = 0; // retain only the horizontal direction
var dist = dir.magnitude ; // get horizontal distance
dir.y = dist * Mathf.Tan(a); // set dir to the elevation angle

dist += h / Mathf.Tan(a);  // correct for small height differences
var vel = Mathf.Sqrt(dist * Physics.gravity.magnitude / Mathf.Sin(2 * a)); 	// calculate the velocity magnitude

var UpVel = dist * Mathf.Sin(angle * (Mathf.PI / 180));

return vel * dir.normalized;

}

This gives the right velocity for the ball, to hit the target, but im a little lost in the math.

I would like to know maybe 3 different points in space, where the ball will pass through at 25%, 50%, and 75% of the trajectory. Right now i just calculate 25% of the horizontal distance, added to the launch position, and set the y to StartUpVelocity * (TrajectoryTime / 4) - ½ * Gravity * (TrajectoryTime / 4) in the power of 2.

But this of course isnt right, becouse 25% of time traveled, is not nescisarily 25% of the distance traveled. Theres also the height difference to account for. The ball is fired from y 2.0, to about y 0.1.

Anyone who can show me the proper calculations, to get Vector3 points in the trajectory given the variables in the code above, accounting for height differences?

This is the script created by me i hope this will be helpfull