I want to launch a projectile in openGL where when I click my left mouse button, it would shoot a sphere to the position where I am facing. BUt I already confused about the distance to launch. I use this code to launch projectile but my program crashed.

thePosition is the position of the camera, Forward is the direction I am looking in the camera, am I done it wrong. Please help. Thank you.

06-02-2012

VirtualAce

What do you mean shoot a sphere to the position you are facing? The facing is the look vector of your camera. If you fire a projectile down the look vector it will fire in the direction the camera is facing.