- Home /
2D - Detect Slopes x Walls
Hey all I`m using Ferr2d to build this 2d platformer here and everything is working smooth but I'm having trouble with walls.
I'm moving my character using:
rb2d.velocity = new Vector2 (h * speed, rb2d.velocity.y);
Where h is the Horizontal Axis input value, and I call that every frame. So if the player is pushing anything H will be 0 and the velocity will as well.
The problem I have is with walls because my player keeps getting stuck to it. The most common solution I`ve found is making the walls "slippery" so to avoid this, and it works fine but the problem is that on ferr2d the terrain is one big thing so both wall and floor can only have one physics material.
Example Terrain with Ferr2D:
I was wondering if anyone has any suggestions? I tried using raycasy from my player to detect the walls and it works most of the time but that ends up breaking the slopes because it keeps thinking the slopes are walls. I was gonna try to detect the angle or something but I`m not sure of how to really….
Any suggestions or directions would really help.
Thanks guys.
Answer by CarreraSilvio · May 13, 2015 at 01:55 PM
I was able to get it working doing:
"change your rigidbody2d components interpolate variable to exterpolate"
Which I found here