Hi! Can i assign wheel collider values in the update function or is this also related to physics calculation and is it better to do it in the fixed update?
This is related to physics calculations, so the best way to do it is in FixedUpdate.
You may assign values in the update function, but these won’t have any effect until the next physics update, which happens immediately after FixedUpdate.
Got it. It’s just that if assigning values from the wheel collider in the fixed update function, the values jump sharply from 0 to the actual. For example, forward slip in physics ticks looks like this: 0, 0.5, 0, 0.7, 0, 1.
If doing this in the update function, the effect of sharp jumps is reduced, but does not disappear completely.
Can you recommend any way to smoothly read the wheel collider parameters, please?
If you need to change the values smoothly, you may do it using Mathf.Lerp or Mathf.MoveTowards from within FixedUpdate.
The values read/written in FixedUpdate are those that are effective in the current/next physics update. If you’re modifying the values within Update, then only the value that happens to enter the next FixedUpdate cycle will have a physical effect. The others are ignored.