I’m trying to iron out some finicky issues involving Rigidbody interpolation in 2D.
Now, I might be incorrect, but here’s how I understand interpolation in Unity. Let’s assume that physics is running at 60 ticks per second and the game is rendering at 100 fps.
- Frame 1: FixedUpdate executes, and we use rigidbody.MovePosition to tell our rb where to head towards for the next FixedUpdate
- Frame 1: Update executes, and Unity automatically picks a location between our previous rb position and our current rb position. Unity moves our transform/collider to that position.
- Frame 2: Update runs again, because we’re rendering faster than our physics tick rate. Unity picks another interpolated position to move our transform to.
- Frame 3: FixedUpdate executes again, whenever its timer tells it to. Our rb’s position is moved to the location we gave it when we previously called MovePosition. And we’ll call MovePosition again at the end of the FixedUpdate to determine our target position for the next FixedUpdate.
And so on.
If this is the case, where exactly does interpolation occur in the Unity execution order? Is it during Update? Is it after Update but before LateUpdate? Or is it something else entirely?