Answer the question
In order to leave comments, you need to log in
Why is the animated character not moving?
hello. it is not possible to set the elementary movement of the character.
character 2D sprite. ordinary bird. There is also a background and a ground. hung a box collider on the ground. on a rigidbody bird and a collider. made an endless animation of the background and ground through scripts. bird animation works. flaps its wings. but now I want that when you press the keys to the left to the right, the bird also moves, but for some reason it doesn’t work and the character stands still. what is the problem? what am I doing wrong?
public class BirdFlying : MonoBehaviour
{
public float speed;
public float jumpForce;
private float moveInput;
private Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
moveInput = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
}
}
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