Rigidbody falling too slow.

Hi,

I’m doing a rigidbody movement script and i noticed that the rigidbody is falling too slowly when i jump or just walk from a ledge. I tried all solutions i could find on the web but none worked for me.
Here is the movement script:

public class PlayerController : MonoBehaviour
{

    public Rigidbody rb;
    public Animator anim;

    public float walkSpeed = 5f;
    public float jumpForce = 100f;
    public LayerMask jumpLayer;
    [SerializeField] float jumpCheckDistance;
   
    void Update()
    {
        if (Input.GetButtonDown("Jump"))
        {
            RaycastHit hit;
            Vector3 rayOffset = new Vector3(0, 1, 0);
            Debug.DrawRay(transform.position, -Vector3.up, Color.yellow);
            if (Physics.Raycast
                (transform.position + rayOffset, -Vector3.up, out hit, jumpCheckDistance, jumpLayer))
            {
                Debug.Log(hit.collider);
                if (hit.collider != null)
                {
                    rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
                }
            }
        }
    }
   
    private void FixedUpdate()
    {
        float h = Input.GetAxisRaw("Horizontal");
        float v = Input.GetAxisRaw("Vertical");
        Move(h, v, walkSpeed);
    }
   
    public void Move(float h, float v, float speed)
    {
        Vector3 movement = new Vector3(h, 0.0f, v);
        movement = movement.normalized * speed * Time.deltaTime;
        movement = transform.TransformDirection(movement);
        rb.AddForce(movement, ForceMode.VelocityChange);

    }
}

What have been all the solutions? If the rigidbody reacts to physics, you maybe should check the gravity and weight of your rigidbody.

1 Like

The rigidbody mass is set to 1, drag to 5, collision detection to Continuous and Gravity is all default. I don’t want to bump up the Gravity because i use lots of rigidbody objects. I tried it and all rigidbodies started to behave strangely.
I also tried to set the Vector3 movement = new Vector3(h, rb.velocity.y, v); but when i jump the player flyes up.
I really don’t know how to fix this issue…

In the physics tab of the project settings you can increase the gravity

1 Like

A drag of 5 is a lot of drag. That’s almost certainly your issue. Why do you have drag set so high? If I set my player’s drag to 5, I float gently to the ground like a feather. Start by setting drag to 0 and that will most likely resolve your issue.

4 Likes

If you’re using playerRb.velocity format while gaining height that means you have just changed the velocity of the game object, that’s why your game object falls very slowly on the ground but if you just reverse or reset the velocity then your game object falls down. Here’s an example I hope it helps

playerRb.velocity = direction * speed * Time.deltaTime; this line of code helps you gain velocity the direction variable is a vector3 speed is a float variable but then if you write this

playerRb.velocity = direction * negativeForce * speed * Time.deltaTime; every variable stays the same but we’re changing the positive velocity to negative or you can make it zero as well then your rigidbody can fall to the ground normally I guess It’s not a perfect code but I hope it makes you understand the part of the problem of while using velocity with rb’s

2 Likes

Yes! This works, thank you! Took a bit of tweaking but I got it