1) So I have a 3d plane and terrain. It's flight forward. The plane is armed with 2 bombs.
2) I shoot bomb, it faster than plane.
3) The problem is when I want move my plane. The bomb is moving with plane
4) I want that bomb move independent after shoot, how can I make it?
I'm beginer in OpenGLI've tired with glPushMatrix and glPopMatrix but it doesn't work. Anyone can help me?
The code:
Code :void renderScene(void) { hMap.DrawHeightMap(); // Draw terrain glPushMatrix(); glTranslatef(xo,yo,zo); // Plane's position glRotatef(graus, 1.0, 0.0, 0.0); //Change plane position glRotatef(grausz, 0.0, 0.0, 1.0); plane->draw(); // Draw plane // Bombs, connect it to "plane position" glPushMatrix(); glTranslatef(-0.35f,-0.22f,bomb1air+(-0.5f)); bomb1->draw(); glTranslatef(0.70f,0.0f,bomb2air+(0.0f-bomb1air)); bomb2->draw(); glTranslatef(-0.35f,0.22f,(0.5f-(bomb1air+bomb2air))); glPopMatrix(); glPopMatrix(); glFlush(); }
When I click shoot, I'm changing bomb1air/bomb2air position+0.01 so it moves faster than plane (in the glutIdleFunc() function).
I've made an image to show you what i mean but unfortunetly I can't post any links.




Reply With Quote