Answer the question
In order to leave comments, you need to log in
How to remove friction in Unity2D?
To remove friction when colliding with walls, I added a physical material to the character's collider and removed Friction in it by 0, but due to the lack of friction, the character began to slide on the ground after the movement stopped. And if Friction is set to 1, then the slip is lost, but the character gets rattled upon contact with the walls. I read on the forums that sliding is due to the movement of the character through Transform and needs to be done through velocity, but for some reason it did not work for me.
Condition for character movement
if (_joystick.Horizontal != 0 && !_isAttacking && _health > 0)
{
_rigidbody.velocity = new Vector2(_joystick.Horizontal * _speed, _rigidbody.velocity.y);
_effect.SetActive(true);
_animator.SetInteger("StateSwordsman", 2);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question