Jump to content

Get terrain slope.


smashthewindow
 Share

Recommended Posts

Is there some engine function to get the slope of the current environment that a controller in on?

I'm guessing that this is possible due to the fact that the controller take's a parameter that set's maximun climb angle of the controller at it's constructor.

If not, I'm thinking raycasting to solve my problem, but I'm just making sure before I go do something stupid.

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

GetTerrainNormal() returns a vector which a terrain triangle is facing, so the slope is orthogonal to that. There's probably some Linear Algebra formula to calculate the orthogonal to a Vec3, perhaps like this:

TVec3 GetOrthogonal( const TVec3& v )  // Return a non-zero vector orthogonal to A.
{
   if( 0 == v.X ) return Vec3( 1, 0, 0 );
   return Vec3( v.Y, -v.X, 0 );
}

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...