Collision detection in a 3D scene

1abd51f7fbf9f44d085064d7ad6bd460
0
SteelFlame 101 Sep 02, 2003 at 17:11

Hi,

I am currently writing the code for some sort of game, which so far loads up a .3ds model/scene and allows free movement around it with mouse and arrow keys. I would like to know how to add collision detection, to prevent walking through objects etc, I have no ideas on how to do this.

Thanks for any help.

7 Replies

Please log in or register to post a reply.

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Sep 02, 2003 at 17:21

Try looking into different techniques on google. The technique you should investigate depends on how accurate you want it. You COULD check down to tri-tri, but that’s almost always not necessary. The most innacurate (probably) is bounding sphere. That’s normally not good enough, but it might be for you. Then you should try bounding boxes. If one bounding box isn’t enough, try using several boxes, one for each section of the model.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Sep 02, 2003 at 18:38

the topic is very broad… there are several techniques that you could apply depending on the way you are going to partition your scene, etc. i also suggest trying google.
as baldurk mentioned the basics involve some sort of bounding volume test depending on the game you want to make. also this is not opengl related so you might want to post this sort of question in the general programming forum

1abd51f7fbf9f44d085064d7ad6bd460
0
SteelFlame 101 Sep 02, 2003 at 18:52

OK thanks. I think bounding box collision detection would be good. So does this mean I have to find a way to place bounding boxes around all the solid objects in my scene? I am using opengl for the game by the way.

Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Sep 02, 2003 at 18:59

You’ll just have to store a bounding box for each object you have in the scene. Also, there are two kinds of bounding boxes:

  1. Axis-Aligned Bounding Boxes (somtimes abbreviated as AABB)
  2. Oriented Bounding Boxes (more accurate)

Axis aligned bounding boxes, as the name suggests, are always aligned to an axis (e.g. x-axis). Oriented bounding boxes can rotate, usually the same orientation of the object associated with the box.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Sep 02, 2003 at 21:43

i’m sorry. i didn’t want to be rude. anyway, this forum normally only deals with topics directly related to opengl

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Sep 03, 2003 at 17:13

I wasn’t really bothered about it, but I think for the sake of clarity and for people searching in the future, I’d better move it.

1abd51f7fbf9f44d085064d7ad6bd460
0
SteelFlame 101 Sep 03, 2003 at 18:05

OK thanks very much. I am much clearer now ;)