Hello guys, I have recently come across a certain problem I am not able to solve myself. My character has BoxCollider on it and it also has Rigidbody.
The problem is that when I try to leave the block the player is currently standing on, I become stuck on the block and I am not able to leave it. I checked every BoxCollider whether it somehow interferes with the player’s colliderbox, but everything was just fine.
After certain time, I found out it was happening because I tried to fix Z rotation, so the player couldn’t roll while moving horizontally. But this also disabled the ability to fall from the block because you have to rotate first to fall down.
Any idea how am I supposed to fix it? Here’s the code that actually does the problem, but is necessary to avoid rolling on the block like mad.
Quaternion q = transform.rotation;
q.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y, 0);
transform.rotation = q;