• Create Account

## Collision Detection with walls

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1Peaceman  Members

122
Like
Likes
Like

Posted 13 December 2001 - 05:28 AM

Hi, can anybosy explain to me how I can make the camera stop in front of walls. If I have two rectangle rooms with a hall between them for example. How could I make the camera proceed into the halls to go to the other room, but not letting the camera ever go outside the room, if u guys understand what I mean... Please help

### #2shalom  Members

122
Like
Likes
Like

Posted 13 December 2001 - 05:42 AM

It gets quite complicated if your walls aren''t parallel with the axes or if collision detection has to be done with the ceiling and floor, too, but that doesn''t seem to be the case. Here''s some pseudo code:

1. If moving in positive x direction, test with all walls facing that way
2. Same with the negative x, and positive and negative z.
3. Using the example of positive x - if camera.x > wall.x and camera.z> wall.z1 and camera.z < wall.z2 then don''t allow movement.

If the walls aren''t parallel with the axes, you''ll have to find the point of intersection between the camera''s movement vector and the wall and test whether its between wall.z1 and wall.z2.

In my thunking device, what happens to the inherited pointer to the original base class when I override the function & how do I access it in my inline assembly code, assuming that we are referencing the higher byte of the 16-bit variable?

### #3Peaceman  Members

122
Like
Likes
Like

Posted 13 December 2001 - 07:50 AM

Isn''t there an ezsier way, for circles for exemple where you can just say something like never cross this spot without if statements and all of that stuff?

### #4rgirard413  Members

133
Like
Likes
Like

Posted 13 December 2001 - 08:53 AM

Depending on how advanced you want your Collision detection/response system to work will determine the complexity of it. Although, any collision detection system will be complex anyhow, and a collision system without comparison statements is virtually impossible. If you are looking for a good system to use, take a look at http://www.peroxide.dk/tutorials/tut10/pxdtut10.html. That provide a lot of checks in many different situations in your "world".

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.