Sudden surge of force applied to a rigidbody from continous jumping.

void Jump(){
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
rb.velocity.Set(0, 0, 0);
rb.angularVelocity.Set(0, 0, 0);

        rb.AddForce(new Vector3(Random.Range(-1,1), 1, 0).normalized * power);
        }
        void Update(){
             if (Input.GetMouseButtonDown(0) && !mouseDown){
              mouseDown = true;
              Jump();
             }
             if (Input.GetMouseButtonUp(0) && mouseDown){
             mouseDown = false;
         }
        }

*This code is called at random time from 0.2seconds to 2seconds to make random movement but it sometimes speed up.

I tried guessing how prevent the rigidbody surging force whenever this code is called but it always happened even I have set the project Maximum Allowed Time to Fixed Time Step. What I’ve done wrong? Where is the problem?

So far i can not tell you exactly why this behaviour exists but perhaps i can give you another way to get your desired behaviour.

First up the function Input.GetMouseButtonDown(0)already only get’s called when you actually press the button down. So unless you don’t need the mouse status otherwise, you can safley remove it from your code.

Secondly you can just go ahead an instead of adding a force just directly set a velocity for your rigidbody.
Something like this:

   void Jump(){
         rb.velocity = new Vector3(Random.Range(-1,1), 1, 0).normalized * power);
         rb.angularVelocity = Vector3.zero;
    }

you probably want to adjust the power value to this new code since depending on the objects mass it might be too large to be applied as velocity.