Hello,
My player sprite is moving along the wall (not even diagonal, just straight down) and get randomly blocked in the corner of some walls. By blocked, I mean that the Y movement is stopped. If I move him away from the wall, he might not be blocked again by the same wall and get blocked at some other walls, always at a corner.
The walls are all the same sprite and are of the same size.
I use 2D Box Colliders for the walls. The player sprite has a Box Collider 2D and a RigidBody 2D. I am not using any physics codes, I would just like to make it work with the built-in Unity physics.
I move the player by adjusting the velocity of the rigidbody according to Input:
RigidBody2D rb = GetComponent<Rigidbody2D>();
float horizontal = Input.GetAxisRaw ("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector2 movement = new Vector2(horizontal, vertical).normalized *speed * Time.deltaTime;
this.rb.velocity = movement;
The player is set like this:
Do you have any idea why it behaves like this and how I could fix it?
Thanks for your help.