hello everyone ,
I have done trajectory motion and its working perfectly…
For calculating velocity i have written code like this :
function GetTrajectoryVelocity( startingPosition : Vector3, targetPosition : Vector3, lob : float , gravity : Vector3) : Vector3
{
var physicsTimestep : float = Time.fixedDeltaTime;
var timestepsPerSecond : float = Mathf.Ceil(1f/physicsTimestep);
var n : float = lob * timestepsPerSecond;
var a : Vector3 = physicsTimestep * physicsTimestep * Physics.gravity;
var p : Vector3 = targetPosition;
var s : Vector3 = startingPosition;
var velocity : Vector3 = (s + (((n * n + n) * a) / 2f) - p) * -1 / n;
velocity /= physicsTimestep;
return velocity;
}
The equation for calculating max height is here : Maximum Height
But i to calculate height using this equation ? I am having velocity , angle .
So my problem is how do i make equation in code?
Thanks for your help till now…