private void FixedUpdate()
{
rb.MovePosition(rb.transform.position + Vector3.right * runSpeed * Time.fixedDeltaTime);
if (Input.GetButtonDown(“Jump”))
{
RaycastHit2D hit = Physics2D.Raycast(rb.transform.position, Vector2.down, jumpSensitivity);
if (hit == true)
rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
}
This is my code. When my script is on, my character moves to the right at the appropriate speed. However, he falls too slowly (he spawns midair). I placed a cube next to him to test the falling speed, and he takes several times longer. When my script is off, however, they fall and hit the ground at the same time.
Anybody know what’s causing this? Thanks!