1. ## Col detect.

Can someone please shed some light on collision detection. I get my collision detected but the way I do it is with physicall coordinates, and obviously thats crap. Basically to start off with how do you determine that the camera has colided with a polygon?

2. ## Re: Col detect.

Hi!
This is not answer. I want to ask you about the moving. I don't want to move the whole scene. I want to move only one object among the others. When I use glTranslatef the whole scene is moving.

3. ## Re: Col detect.

Hehehe, OK thats easy.
glPushMatrix();
glTranslatef(whatever);
glBegin(WHAT_EVER);
//
...
...
...
//
glEnd();
glPopMatrix();
By doing this you are only translating the current matrix. If glTranslatef() is within the push/pop matrix, it doesn't effect the rest of the scene. Hope it helps.

4. ## Re: Col detect.

Oh,Thank you!
Now I understand, at last. It is good that there are such good people like you in this forum. They help to the beginners like me.

5. ## Re: Col detect.

Hehe, thanks but I'm pretty much a begginer myself.

6. ## Re: Col detect.

You meant camera as a point, or the view volume defined by the camera's clipping planes?

7. ## Re: Col detect.

Well lets take a first person perspective.
How do you know when you walk into a wall. I know about the sphere thing, but don't understand it all that well yet. So I mean camera as in explained here.

8. ## Re: Col detect.

From what I understand... he's talking about the camera as a point...

You can try using something like portals and BSP trees to minimize the checks needed for collision detection. They greatly reduce the amount of unnecessary checks for collision. Then maybe you could try to check for collision with only those walls that are in front of you (through BSP trees).

If you dont want to do that much work then a simple hack is ...

when drawing a vertical wall ( in the main draw loop ) check your existing point and the points of the wall. If your point is within boundaries of the wall then check your points normal of the direction that your moving in. compare it with the normal of the wall ( which should be pre calculated ) and if they are opposite then stop movement.

... this may not be a very efficient approach but you can make it more efficient by using BSP trees. Also you can add other checks if the wall in front is of a certain height then you can climb over it etc.

Hope this helps....

Fastian

"It is better to know OpenGL then to keep thinking which 3D API to start with "

9. ## Re: Col detect.

Aaaah cool.
Thats actaully a good idea!
I started looking at BSP, but sheeesh, it's gonna take me a while to know it. And this is only for a small demonstration, so that other method should work cool

10. ## Re: Col detect.

Easy, most first person perspective games implement some form of collision map. The collision map (either explicitly or procedurally) which is derived from the architectural map. The collsion map is nothing more than a set of plane segments that define the boundaries of solid (or rather blocking) objects. You simply check your new position against the collision map to see if it is allowed. And if its not, you clip the movement by the plane that is blocking the motion. The tricky part is determining which planes to test as you don't want to test all planes. You need to test only those planes that would have a chance of blocking you.

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•