I have an edge collider 2D and sometimes I wanna gravity make me slip and some times not,
Any Idea? Thanks
edit: I’m using rigidbody2D, i saw some guys did it without it, but i think that use rb is a better practice.
I have an edge collider 2D and sometimes I wanna gravity make me slip and some times not,
Any Idea? Thanks
edit: I’m using rigidbody2D, i saw some guys did it without it, but i think that use rb is a better practice.
Hi there,
Actually you have some different options here.
The most direct one, is to change the friction of the surface. You can create Physics Material 2D, and set a different friction, then drag it to the edge collider, that you want. That way, the friction will stop the object from falling down (It depends on the Slope and the amount of friction). The problem with this method, is that it will be harder for the object to move.
Another way, could be setting trigger regions in your scene. For example, a box collider surrounding the edge collider, but this box collider with the property “Is trigger” active. That way, when you enter this region, you will know that your gameObject is not going to slide. You can change the gravity, or even add different forces to avoid sliding.
Hope it helps.