Monday, May 7, 2012

A new version of my 3D asteroid game in OpenGL with C#


This article is an update of my first article named “A basic 3D asteroid game in OpenGL with C#”. In this version I added the shooting feature. I will try to explain it briefly here
The first thing to do is to get the mesh that contains the rocket
Mesh misiles; //This goes as a class attribute

misiles = m.GetMeshWithName("avion07");

After getting the mesh reference we delete it from the model because we are going to draw and manage it in a different way than the ship.
One drawback is that in the 3d model the four rockets are recognized as a single mesh, that’s why when we shot a missile the four are shot. I don’t have too much knowledge of 3D Max to make the four missiles as single meshes and that brings another complication; the missile position is the same for all, which means that we are going to check collisions on one single point that is the center of the four missiles.