Answer the question
In order to leave comments, you need to log in
How to fix the walking bug?
In general, when my character tries to walk on a horizontal surface, he bugs and does not want to go further. How to fix it?
RigidBody Video :
Collider: Walk
Script:
public float speed = 10f;
Rigidbody2D rb;
public float move = 0f;
public bool isGround = false;
public float jumpForce = 6f;
void Update()
{
if(move == 0) {
animator.SetFloat("Speed", 0);
}else animator.SetFloat("Speed", Mathf.Abs(move));
transform.Translate(transform.right * move * speed * Time.deltaTime);
}
public void Jump() {
if (isGround && !isUp && !PausePanel.activeSelf) {
rb.AddForce(transform.up * jumpForce, ForceMode2D.Impulse);
animator.SetTrigger("TakeOf");
}
}
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