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.Code:void CProjectile::render() { glPushMatrix(); glColor3f(1,1,0); glTranslatef(theCamera-> Forward.x - theCamera-> Position.x , theCamera->Forward.y - theCamera-> Position.y, theCamera-> Forward.z - theCamera->Position.z); drawSphere(); glPopMatrix(); } void CProjectile::drawSphere() { glSolidSphere(10,10,10); }



LinkBack URL
About LinkBacks


