- Home /
Collision normal angles.
A simple scripting query. I seem to be having trouble determining the angles of some collisions.
I have a character (capsule collider), and I want to know the angle between the surface's normal and my character's orientation. I also want to know what point on the character's collider said surface is touching.
This is basically so I can determine whether the character has any ground to walk on, and if he's colliding with a wall. Unless, of course, anyone has a better suggestion for determining those ideas.
Answer by themusicdork · Sep 05, 2011 at 09:37 PM
use a raycast from your character directly down (however far you need) and then use the RaycastHit class to load everything you need. as for the surface normal, I don't know. You could try raycasting downand a little forward and down and a little back and find the average slope of the two collision points? (i am to lazy to come up with the code. But the theory is right =P)