Camera sensing the walls

mnm23

16-09-2006 04:49:06

Hey guys. Hows it going. Im trying to use ray casting to block my camera from going through the walls. No luck so far. Basically what i want to do is, have the camera get close to the wall and if the player is still turing or moving closer to the wall where the camera would normally go through the wall instead it would move closer to the player along the z-axis. I have used ray casting before, but only for the y-axis. I have gone through the forum and tried to manipulate some of the examples so i could use it for the z-axis but no luck so far. The ray doesnt even detect any of the walls when i change the code to the y-axis it seems to work fine. Can anyone give me any suggestions on how I can fix this. Thanks much appreciated.

betajaen

16-09-2006 09:40:35

Alright, (I've written this post three times).

I'm assuming this is for a 3rd person, pretty much like the indoor character controller demo is.

The camera would be a body with one-way collisions.

To detect things and move away use a spherical intersection every other frame within 1.5 metres to detect bodies. Once it detects a body that a) isn't the camera b) isn't the player, move the body away in the reverse direction.

mnm23

17-09-2006 05:22:30

Hey betajean, thanks for the reply. Ill give it a try.