Hello, I'm making a little ski game and I want to have crash detect. So if you land too sideways it will trigger the crashing animation. How can I read what the rotation of the character is in relation to the normals?
Let's say the crash tolerance is 45 degrees. The character is rotated 45 degrees but the ground is also at a 45 degree slope meaning the sum of the two would be 90, making the character land on his side. Here's a little diagram of what I mean:
PS he's not pissing blood, that's a raycast :)
asked Jun 11 '12 at 05:48 PM
OnCollisionEnter (when the player touches the slope) provides you the normal at the impact through CollisionInfo.ContactPoint. I suggest you calculate the dot product between that normal and transform.up (of the player). If it is > 0.7 for instance, the landing is safe. Reminder : angle = acos(dotproduct).
Or you could use Vector3.Angle.
PS : Awesome drawing :p