Advertisement

Collision detection

Started by April 13, 2003 05:21 AM
0 comments, last by circuit 21 years, 10 months ago

  
glLoadIdentity();
glRotatef(-camera.pitch, 1, 0, 0);
glRotatef(-camera.heading, 0, 1, 0);
glTranslatef(-camera.position.x, 
             -camera.position.y,
             -camera.position.z);

glPushMatrix();
glTranslatef(model1.position.x,
             model1.position.y,
             model1.position.z);
glRotatef(model1.heading, 0, 1, 0);
drawModel(&model1);
glPopMatrix();

glPushMatrix();
glTranslatef(model2.position.x,
             model2.position.y,
             model2.position.z);
glRotatef(model2.heading, 0, 1, 0);
drawModel(&model2);
glPopMatrix();
  
I want to do per polygon collision detection to the 2 models. YES I DO know how to find out if two polygons intersect. But the problem is that there are multible translations and rotations applied to the models. So how do I find the "new" polygons that I can use for collision detection?
Transform the polygons yourself. You'll need some basic vector*matrix and maybe matrix*matrix functions.

If you don't want to construct the individual transformations directly (can be better because you have more control, but is more work), you can use glGetFloat() to extract the transform matrices you are using.

[edited by - JuNC on April 13, 2003 9:12:26 AM]

This topic is closed to new replies.

Advertisement