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.
Please log in or register to post a reply.
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.
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
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
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:
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.
i’m sorry. i didn’t want to be rude. anyway, this forum normally only
deals with topics directly related to opengl
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.
OK thanks very much. I am much clearer now ;)