Detecting point of collision

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.

–Eric

Thanks a lot. But unless there’s another way to use it, the values this return, is those relative to the space.world and not to the character itself…?

Vector3 relative = contact.point - transform.position;

Yes, but you can very easily transform the contact point into the character’s local space.

C#

void OnCollisionEnter(Collision collision)
{
   Vector3 contactPointWorld = collision.contacts[0].point;
   Vector3 contactPointLocal = transform.worldToLocalMatrix * contactPointWorld;
}