top of page
Antares Studio Games Icon_Small.png

The Antares Alien

Power BI   |  DAX

Player Can't Go Up Slope Problem

Writer's picture: Brent JonesBrent Jones

For the longest time, I avoided steep slopes in my game. This was because the player would get stuck on the floor collider due to the floor's material properties - the floor had a good amount of friction to prevent the player from sliding. This works well on a level ground, but prevents movement up a slope.



I had experimented with adjusting the player's gravity, but found it to became too complicated as it depended on the angle of the slope, and it just wasn't worth the effort.


However, I finally found a solution (that works for me at least). There's no complicated math involved so it's easy to understand and implement.


My Solution

Basically, I just added a second floor collider underneath the original floor. This second floor collider will have a slippery material.



The idea is whenever the player is moving, I'll just move the new floor slightly above the original floor. This way, the player "slides" up the slope. When the player stops moving, the second floor returns to its original position leaving the player to rest on the first floor without sliding down it.


The script is relatively short - just a couple lines.




Add this script to the new floor....


And now the player easily slides up the slope!



Comments


  • Facebook
  • Twitter
  • Instagram

Follow

  • linkedin
  • facebook
  • Twitter - Black Circle

©2021 BY ANTARES ANLYTICS. PROUDLY CREATED WITH WIX.COM

bottom of page