So I understand that FixedUpdate should be used for physics operations and such but I am having trouble understanding what counts as physics. So for example, I move my character by looking at what keys are pressed then I apply a force. Currently I am doing this in Update(). Should this functionality be moved to FixedUpdate() since addForce is code that's being applied to a physics object (the player, since it has a rigidbody component)?
But then, if I do move this code to fixedUpdate(), would it be fine to run the input.GetKey in that method? I read somewhere that inputs can get dropped if they're listened for in FixedUpdate()? So yeah, confusing...It almost sounds like Input.GetKey should be in Update() and when a key is pressed a flag is activated. Meanwhile, the functionality in FixedUpdate() is watching for the appropriate flag to be activated. And such...This way input is handled in Update() and movement is in FixedUpdate()...am I understanding this right?
Also, I am using colliders and triggers, would the code for these also be located in FixedUpdate()?
Aucun commentaire:
Enregistrer un commentaire