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.
glTranslatef(theCamera-> Forward.x - theCamera-> Position.x , theCamera->Forward.y - theCamera-> Position.y, theCamera-> Forward.z - theCamera->Position.z);