Hey folks! Does anyone have any good examples of code for shooting a projectile (in 3D space) from a known start point to a known end point? Possibly by determining the initial vector with which to add force?
I’ve been reading a lot about the physics involved, and it appears that it gets rather messy due to the different possibilities for initial velocity / initial arc, but I figured maybe someone had a good implementation that took into account max allowed velocity, etc.
E.g.,
var start = Vector3(1,2,3);
var end = Vector3(10,11,12);
var vec = getProjectileVec(start, end, MAX_VELOCITY);
if (vec)
projectile.AddForce(vec);
Thanks!
Regards,
Mike