FixedUpdate

FixedUpdate is called for every fixed framerate frame, if MonoBehavior is enabled.

FixedUpdate should be used instead of Update when dealing with Rigidbody. For example, when adding a force to a rigidbody, you have to apply the force for every fixed frame inside FixedUpdate instead of every frame inside Update, because the physics simulation is carried out in discrete timesteps. The FixedUpdate function is called immediately before each step.

Example

// Apply an upward force to the rigidbody every frame
function FixedUpdate () {
  rigidBody.AddForce(Vector3.up);
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.17.27