Guys, I need a way to detect simple collision with walls. My map is pretty basic. All the floor is on the same height and I have very simple walls that I need to collide with.
Two ways come to mind and I'm wondering what's better.
1st - Put one camera watching my hero from above. Use this camera to render the depth values in front of the hero in another framebuffer. If the depth values in front of the hero are less than the depth value of some fragment from the hero, then there is a wall in front of him.
OR
2nd. Make AABBs for every wall. The problem with this is that every time there is a turn, I need to divide the wall into separate meshes and find the AABB for that mesh, because if the wall is like this:
(top view)
____
| |
___ | |
|_______ |
And I count these two rectangles as one mesh and find the min and max x,y,z of the two figures, the AABB is going to be this:
(top view)
________
| |
| |
|______ _|
And this is very inaccurate. That's why I have to make a new mesh every time the wall turns left or right.
What to choose?
I hope someone understood something from this very bad explanation. :lol: