I have a ball that has a rigidbody and a circle collider on it. I have the following script applied to it:
public class PlayerController : MonoBehaviour
{
[SerializeField] float speed = 400f;
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
float move = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
rb.MovePosition(rb.position + new Vector2(move, 0f));
}
}
The ball is in mid air in the scene. When I hit play, the ball falls but it doesn’t fall quickly like it did without me writing “rb.MovePosition” method. What’s the problem and how can I fix this?
Thanks