How can I get the ground slope angle from a physx character controller?

This topic is 2750 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I need to get the slope angle of the ground below my character controller but I can't think of how this would be done?

Share on other sites
If you have the normal, you can get the angle as follows (untested):

angle = acos(clamp(normal.z, -1, 1));
If +z is not up, adjust accordingly (for example, for +y up, you'd use normal.y).

Share on other sites

If you have the normal, you can get the angle as follows (untested):

angle = acos(clamp(normal.z, -1, 1));
If +z is not up, adjust accordingly (for example, for +y up, you'd use normal.y).

Well that is part of what I need but I also need to actually get the triangle from PhysX.

Share on other sites
I just realized I can use the NxUserControllerHitReport to get a normal. This gets a normal that is facing outward from a triangle. I am trying to cause the controller to slide down slopes that are too steep. So, from that I need to get a normal that is parallel to that normal and always facing down.

Share on other sites

So, from that I need to get a normal that is parallel to that normal and always facing down.

I'm not completely sure what you mean by that. Can you clarify?

Share on other sites

[quote name='SteveDeFacto' timestamp='1299783734' post='4784095']
So, from that I need to get a normal that is parallel to that normal and always facing down.

I'm not completely sure what you mean by that. Can you clarify?
[/quote]

Yeah, reading that again even confused me. I'm actually not sure how to explain what I was saying but it was unnecessary anyway. I figured if I pushed the controller directly away from the face it would cause it to bounce off the slope, fall back on, bounce off again, and continue to do it until it reached a surface below it's slope limit. I thought this would cause jittering but I was wrong and the controller actually glides over the surface perfectly. Everything is working perfect now and I didn't even have to create a custom controller class like the physx forum mods said I would!

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• Forum Statistics

• Total Topics
632591
• Total Posts
3007250

×