Collision Detection with walls

Started by
2 comments, last by Peaceman 22 years, 4 months ago
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
Advertisement
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?
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?
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?
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".
http://www.thedizzle.com

This topic is closed to new replies.

Advertisement