findProjectileTrajectory

Finds a projectile's position at a certain time.

Variable Definitions : ri = initial position {x, y} ; vi = intial velocity {vx, vy} ; g = gravity {gx, gy} ; t = time

-- This assumes that ri, vi, and g are put in the {x, y} notation
function findProjectileTrajectory(ri, vi, g, t)
	local rfx = ri[1] + vi[1]*t + (g[1] * t^2)/2
	local rfy = ri[2] + vi[2]*t + (g[2] * t^2)/2
	return rfx, rfy
end


Other Languages