I’m truly sorry if this has been discussed before, but I couldn’t find it anywhere, so here goes:
I’m building a 2D platformer, using transparent cubes, where each cube has a plane attached to it to display the given animations through sprite sheets.
This actually works really great for me, but I’m having a little trouble with some basic stuff.
I really need to know what side of the cube is colliding at any given time, you know, so I can let the character die if a monster runs into him, but have the monster die, if he jumps on it and so forth.
I tried using raycasting in the 4 directions that matter, but this leaves me with some issues, if my collision doesn’t hit on any of the 4 specific points.
I considered another approach, where I make 4 additional transparent cubes just for collision detection, and them have them call functions inside the main script of the cube that acts as the character, but that seems just a little over the top for something as simple as this.
Any ideas, or am I missing something?
EDIT: Forgot to mention; I’m using javascript.