The character velocity changes while the rigidbody is kinematic

In the Walk function, the velocity changes although the rigidbody is kinematic. I am changing the rigidbody to non-kinematic after the setting the velocity.

In the Jump function, the velocity changes after setting the rigidbody to non-kinematic. I know the Jump function is the correct way to do so but how in the Walk function it’s working?

Shouldn’t the velocity change only when the body is non-kinematic?


 public virtual void Walk(float value) {
           var targetVelocity = new Vector2(speed * value, body.velocity.y);
           body.velocity = Vector3.SmoothDamp(body.velocity, targetVelocity, 
                     ref _velocity, m_MovementSmoothing);
           if (body.isKinematic) { body.isKinematic = false; }
        }
    
  public virtual void Jump() {
           if (body.isKinematic) { body.isKinematic = false; }
           body.AddForce(transform.up * jumpForce, ForceMode2D.Impulse);
    }

I imagine thats just how gets coded, you cant add a force to a rigidbody that is set to kinematic, inside the addforce method there will be an if making sure the body is not kinematic, but the velocity is a property, and inside the property there is no if checking the body kinematic, so you can set the velocity and as long as in the next physics cicle isnt set to kinematic it will work, it seems logic to me.

Since remember that changing the rigidbody propertys in the fixedupdate will not get “Updated” untill the next physics cicle