Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Limiting Max Velocity without ClampMagnitude

Discussion in 'Physics' started by rameshmadara, Nov 6, 2020.

  1. rameshmadara

    rameshmadara

    Joined:
    Nov 5, 2020
    Posts:
    48
    In this game I'm experimenting on i want his ball/rigidbody to have a max velocity. Bt the ClampMagnitude method interferes with some other mechanics of the game. Is there any other way to go about this?


    //LIMITTING VELOCITY
    if (rb.velocity.magnitude > limitVelocity)
    {
    rb.velocity = Vector3.ClampMagnitude(rb.velocity, limitVelocity);
    Debug.Log("limitting");
    }