Jump to content


Collision detection in a 3D scene


7 replies to this topic

#1 SteelFlame

    New Member

  • Members
  • Pip
  • 3 posts

Posted 02 September 2003 - 05:11 PM

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.

#2 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 02 September 2003 - 05:21 PM

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.
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#3 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 02 September 2003 - 06:38 PM

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
If Prolog is the answer, what is the question ?

#4 SteelFlame

    New Member

  • Members
  • Pip
  • 3 posts

Posted 02 September 2003 - 06:52 PM

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.

#5 Dia

    DevMaster Staff

  • Administrators
  • 1120 posts

Posted 02 September 2003 - 06:59 PM

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.

#6 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 02 September 2003 - 09:43 PM

i'm sorry. i didn't want to be rude. anyway, this forum normally only deals with topics directly related to opengl
If Prolog is the answer, what is the question ?

#7 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 03 September 2003 - 05:13 PM

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.
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#8 SteelFlame

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 September 2003 - 06:05 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users