Rigidbody Interpolation and Transform Synchronization

Hi,
I’m trying to implement custom interpolation for non-kinematic rigidbody, since I’ve just discovered (not before having used it for quite some time) that MovePosition doesn’t take interpolation into account.
Actually this is not mentioned in the current MovePosition documentation, but it does for older versions (until Unity 2019), so maybe it’s just an oversight as it was on the very last line.

In order for my interpolator to work properly, I need to exactly determine when synchronization between rigidbody and transform occurs.

After trials and experiments I came up with the following scheme:

[ — FixedUpdate — (rb ← tr) Physics Step (tr ← rb) ] — (rb ← tr)* Update —

  • Only occurs if in the scene there is at least one rigidbody set to interpolate and if on the previous Update the transform was modified.

Assumes Physics.autoSyncTransforms is false.
(rb ← tr) sync from transform to rigidbody.
(tr ← rb) sync from rigidbody to transform.

Can someone confirm or help me better understand?
Is it expected that even just a single rigidbody with interpolation affects every other rigidbody?

Yes, in 3D physics MovePosition just instantly teleports the Dynamic body to the target position but you don’t need some special interpolation, MovePosition isn’t really that special, it’s essentially setting the velocity such that it’ll move from its current position to the target position in a single simulation step. If you turn-off gravity and remove linear-drag from the body then you’ve got the same thing i.e. approximately: velocity = (target - current) / Time.fixedDeltaTime

The same goes for MoveRotation but with angular velocity.

Interpolation works fine by just setting the velocity which is essentially what MovePosition/MoveRotation do behind the scenes.

MovePosition and MoveRotation do use and apply interpolation on kinematic rigidbodies. However, using them in non-kinematic Rigidbodies means overriding the results of the physics solver, which messes up the interpolation and may cause jittering.

Without knowing about your specific case, I can only suggest to consider one of the two alternatives that work consistently for Rigidbodies and Interpolation:

A) Make the Rigidbody kinematic, then move it exclusively with MovePosition and MoveRotation from FixedUpdate.

B) In non-kinematic bodies, move them with AddForce methods only. You may use the parameter ForceMode.VelocityChange to impose a specific velocity, which could be calculated out of a target position / rotation.

I’m using MovePosition to adjust the offset from the ground without affecting the velocity. My interpolator already seems to work fine, I just need confirmation on when synchronization occurs.
Also it seems weird to me that if I enable built-in interpolation on any rigidbody in the scene, it breaks my interpolation even if it is on a different rigidbody.