Archived

This topic is now archived and is closed to further replies.

jon723

Collisions between groups of polygons

Recommended Posts

jon723    168
I have two models that I am trying to do bounding box collision detection between. One of the models is the player model and the other is the world moel which is composed of groups of other polygons. I have a bounding box collision routine which checks the groups of the level model against the player model but when the player moves it goes through the objects. I assume the problem is that I''m not converting the coordinates into world coordinates, how would I go about doing that. It should be noted that I am using OpenGL for this project. Any help would be greatly appreciated. Also, here is the collision routine that I have for the test: bool World::WorldCollision(Player *player) { for(int n = 0; n < objModel->numgroups; n++) // loop through the level objects { CVector gMin = min[n]; CVector gMax = max[n]; if(player->max->xpos <= gMin.xpos) return false; if(player->min->xpos >= gMax.xpos) return false; if(player->max->ypos <= gMin.ypos) return false; if(player->min->ypos >= gMax.ypos) return false; if(player->max->zpos <= gMin.zpos) return false; if(player->min->zpos >= gMax.zpos) return false; } return true; }

Share this post


Link to post
Share on other sites