- Home /
transform.position in fixedUpdate() different from transform.position in Update();
I have been trying for some time to do a raycast from fixedUpdate() that is supposed to originate from the center of the sphere in the downwards direction. Problem is that at the higher speeds (10+) raycast does not happen from the sphere's transform.position but rather lags behind to the extent where the ray isn't even in the object itself anymore but a lenght or two behind and the distance increases with speed. There is no such problem in the update() as the transfrom.position in Update() is correct even under high speeds.
Pseudo-code:
fixedUpdate(): position = transform.position; ray(origin = position, direction = -transform.up);
Well, this would be because FixedUpdate does pretty much that. The function is called every fixed frame, ins$$anonymous$$d of every frame.
https://docs.unity3d.com/ScriptReference/$$anonymous$$onoBehaviour.FixedUpdate.html
https://docs.unity3d.com/ScriptReference/$$anonymous$$onoBehaviour.Update.html
Answer by CubeCrafter360 · Oct 17, 2016 at 08:42 AM
yes upadate is hapening every frame and i think fixedudate happends every second