x


How can I detect the angle of the platform the player is on?

Attempting to have my player slide down steep slopes ( >45º), and I know how to code into my character controller the sliding movement, but I can't figure out is how to detect when the player is actually standing on a slope… It's not a rotated platform, so I can't get the rotational value, it's just a basic mesh with a slope. Any of you guys know the answer?

more ▼

asked Feb 24 '12 at 06:43 AM

Essential gravatar image

Essential
480 48 65 79

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Okay I figured out that I need to grab the normal.

function OnControllerColliderHit(hit : ControllerColliderHit) {
    Debug.Log("Normal vector we collided at: " + hit.normal);
}

http://unity3d.com/support/documentation/ScriptReference/ControllerColliderHit-normal.html

more ▼

answered Feb 24 '12 at 08:07 AM

Essential gravatar image

Essential
480 48 65 79

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1041
x286
x74
x50

asked: Feb 24 '12 at 06:43 AM

Seen: 958 times

Last Updated: Feb 24 '12 at 08:07 AM