Download

Tutorial: Change Character Speed Based on Hill Slope / Angle

Hey all,

I recently got the chance to create a basic movement system which takes into account the angle or slope of a hill and either speeds up or slows down the character so I figured I’d make a tutorial and show it off here for others!

Here is the link:

http://gregmladucky.com/blog/?p=555

A quick overview of what the tutorial is all about:

This idea came about when a student of mine wanted to explore a landscape they created in Unreal but felt like running up large mountains and hills at the same speed they moved down was strange and unrealistic. Instead they wanted to simply slow the character down as they climb a steep slope and speed them up when running down hill.

We worked out a quick solution and I wanted to share it here for others! We will make a system that:

  • Sets the character speed based on current angle of their surface
  • Uses two line traces
  • Uses float curve to control our speed
  • Blueprint only
  • Using Unreal Engine 4.8.1

Here it is in action:

https://youtube.com/watch?v=6KPfLdoMf1Y

Hopefully it helps others out!

Cheers!

Nice tutorial, thanks for the share :slight_smile:

Thanks!

I have integrated this into my game and it works very well. Because i’ve changed the base walk speed of the third person character in my game i also had to edit the curve and some of the constants, but this was trivial and easy to do.

Very nice tutorial and simple code, thanks for sharing!

Thanks, I’ll apply it to my project as well!