Cameras and Walls (3D Noob)

BlitzMax Forums/MiniB3D Module/Cameras and Walls (3D Noob)

CASO(Posted 2007) [#1]
I have a code (that I'm think came with Maplet) and it lets you walk through the places you create. However, it is set in first-person view. I tried moving the camera back to create a third-person view, but the camera can go through a wall and ruin that feel of being inside.

What is the easiest way to create third-person view without letting the camera go through a wall?


JoshK(Posted 2007) [#2]
That's weird, the wall should stop you from going through. Does the wall use a transparent texture, like water? You might need to use a heavier texture, something solid like wood or brick.


CASO(Posted 2007) [#3]
It stops the player (sphere) from going through, but not the camera. I tried to make the camera a 'solid', but then I had problems keeping the camera a set distance behind the player. I think I am missing an important concept or something.


TomToad(Posted 2007) [#4]
This is actually a common problem with 3rd person programs. You need to figure out how to intelligently move the camera when walls or other objects start to get in the way.
There is an example in the code archives here
http://www.blitzbasic.com/codearcs/codearcs.php?code=1083


CASO(Posted 2007) [#5]
I translated and tried the code (Posted Above), but it didn't do what I wanted. I want the camera to not go outside of a mesh 'building'. The player can't get out, but the camera can.


klepto2(Posted 2007) [#6]
To let the camera not pass the walls you have to create a collidable Pivot which is set to sliding collision. to this pivor you parent the camera. Or you update the position and rotation manual to avoid that the camera will look through the walls.
If you have no idea what I'm talking about I will make you an example.


CASO(Posted 2007) [#7]
I vaguely understand, but I really like examples.


klepto2(Posted 2007) [#8]
OK ;)

Here is a modified castle demo code with 3rd person control:



I hope this works in the way you want.


CASO(Posted 2007) [#9]
Thanks klepto2. That works wonderfully. I used standard MiniB3D though.