playMaker

Author Topic: Avoid The Player Sliding Down A Slope  (Read 1783 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Avoid The Player Sliding Down A Slope
« on: November 26, 2017, 07:07:46 AM »
Is it a way to avoid the player to slide down from a slope?
See the video.


I want the player to stand on a slope when I'm not moving without sliding down. I tried to change the friction of the Physic Material to 1, but it didn't work. I found a way, but I don't know if it's a good solution.

I use 2 colliders on the Player. One where I have the friction of the Physic Material
to 0 and the other collider where I have the friction to 1. And when I'm moving, jumping and falling, I enable the collider with the friction = 0 and disable the other collider with the friction = 1. When the player is in the idle mode and of course on the ground, I do the opposite.

I just want to know if there is a better way to do it, or if this way is good enough.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Ofonna

  • Full Member
  • ***
  • Posts: 230
Re: Avoid The Player Sliding Down A Slope
« Reply #1 on: November 26, 2017, 10:20:14 AM »
on your physics material set static friction to maximum

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Avoid The Player Sliding Down A Slope
« Reply #2 on: November 29, 2017, 12:20:13 PM »
Hi!
Do you mean I should click on the physic material in the project window and set the static friction to maximum? Then the player will be stuck in the wall while he's falling or jumping. Or do you mean that I should use set properties in a FSM and change the friction in that way? Doesn't work either. It change the value, but it doesn't affect the player. When I stop the game, I can see that the friction value is changed.

Other suggestions?  :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no