Jump to content
  • Advertisement
Sign in to follow this  
RetroBilly

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

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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! smile.gif

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!