# The rotation of an object in relation to ground

 0 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 :) example.jpg (34.1 kB) more ▼ asked Jun 11 '12 at 05:48 PM commodore 113 ● 8 ● 23 ● 31 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 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 more ▼ answered Jun 11 '12 at 06:18 PM Berenger 11.2k ● 12 ● 19 ● 54 Thanks! I'll mess around with it when I get home. Jun 11 '12 at 06:22 PM commodore Try out Ski Safari by the, it's great ! Jun 11 '12 at 06:31 PM Berenger Man that's fun! I'll be sure to show you my game once it's done Jun 11 '12 at 06:42 PM commodore add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1580
x128
x85

asked: Jun 11 '12 at 05:48 PM

Seen: 527 times

Last Updated: Jun 11 '12 at 06:42 PM