OpenGL: navigating a 3D scene (a room with walls) with collision detection [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve th开发者_Python百科is questionFor a school project, I have to be able to move inside a 3D scene like a room and implement collision detection with its walls.
I'm looking for tutorials and bibliography that deals with the subject.
I already have the Redbook and Opengl's Superbible.
Simplest thing that comes to mind is using a Colour Map of the top view of the room. Basically you create a bitmap using only 2 colours:
- One that will determine your 'walls'
- One for 'everything else'
Here are a few articles found by googling:
- 2D Collision Detection using a Color Map
- Collision Detection and Bounce Calculation using Colour Maps
They use different languages, but that's irrelevant, the principle is the same.
Once you've got the colour map, you will have ratio to convert from x,z in your 3D to x,y in the 2D colour map. In theory, if you want, you could generate the colour map at runtime, rendering an ortographic top view. You would render just the walls using the fact that the walls will probably by the 'tallest' objects in your scene.
HTH
Those guys are pretty good at it: http://www2.imm.dtu.dk/visiondag/
You can try and contact them. I took a course there but I don't have the exact references here.
Here there is a course links with tutorial:
http://www2.imm.dtu.dk/~bdl/virtualreality.html
There is an entire book on Real-Time Collision Detection.
Before you write your own collision detector from scratch, you should consider implementing the rest of your setup and plugging in an existing library. It is much easier to develop a program, if you have a correct result to compare to.
The GAMMA research group has developed a number of collision detection packages that are popular in robotics and more. You or your institution may ask them for a package for non-commercial or academic use. One of these packages, PQP, is the inspiration for Yaobi, an open-source C++ library.
Yaobi and PQP are both easy to use, requiring only a bunch of triangles to model a geometry.
精彩评论