Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

hello_there

gradient of slope

This topic is 5405 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

I want to get the gradient of triangles in my terrain. I though of a way to do it by seeing how close to 1 or -1 the y normal is. Would this work properly?

Share this post


Link to post
Share on other sites
Advertisement
Not sure how you want the gradient... If you want an angle you can use the dot-product of the normal and the ''Up'' vector. Which would give you a value between 0 and 1 negative numbers would mean the normal is pointing down (1 being flat, 0 being vertical(not possible for square heightmaps)

Share this post


Link to post
Share on other sites
It''s not realy the gradient i want realy it''s the steepness of the triangle. I''m pretty sure it works. I now have another problem if the slope is to steep I want the player to slide down. I thought of a way to do this by finding where a ray with x and z direction of the planes normal and the y position it is below the triangle intersects the plane to get the new slide position. I was wondering is there an easier way or better way do to it? (if you can understand that)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!