Answer the question
In order to leave comments, you need to log in
What will happen if you work with physics in Update?
Perhaps the question was raised a little incorrectly, I'm wondering how unity behaves if, for example, in update I will produce Physics.RayCast. After all, any request to work with physics is processed in FixedUpdade.
Answer the question
In order to leave comments, you need to log in
Raycast will work where you call it - it will not go anywhere in the fixed update.
When they say that "physics works in fixed mode" - it means that the physical engine itself considers changes in objects in fixed mode. It follows from this that if you work with physics in an update, then the states of objects may not be updated, for example.
Not processed, but should be processed.
In the case you describe, the speed of the physical process will directly depend on the number of processes (load), as a result, the result of the process performed may differ both on different computers, tau and on one, from session to session, depending on the load of third-party applications.
Main difference?
Update - tied to FPS, can be called once per second. And deltaTime you will also get 1s, and if you move the object, then immediately it will fly away from you far beyond 1 time by a conditional 1m.
FixedUpdate - will call as often as specified in the settings. Even if it doesn't keep up, it will be called as many times as needed. Therefore, in the same second that Update is called with FPS=1, FixedUpdate will be called 60 times (with default settings). And therefore, you will move the object by the same 1m, but still for 60 checkers, and maybe somewhere in the middle of the path a trigger will work or something.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question