public sealed class NetworkRigidBodyCorrectionSystemPulls a body that is not ours toward where the authority says it is.
No guide page documents this yet — the page shows what the code says about itself.
As a system
- Phase
- FixedUpdate
- Runs before
- PhysicsWritebackSystem
Remarks
Through the solver, not around it. The received pose is not written onto the body. What is written is a velocity that would carry the body there, so it arrives under the simulation's own rules — colliding with what is in the way, resting on what it lands on, and being pushed back by anything it cannot move through. Setting the transform instead is what makes networked physics look like objects teleporting through each other.
Critically damped. The correction velocity is error × frequency, which is the critically damped solution for a spring with no overshoot: fastest convergence that never passes the target. Underdamped and the crate oscillates around its true position; overdamped and it never quite arrives. The frequency is PositionStrength and is a property of the object rather than a global, because a crate and a car want different answers.
And the snap, which is not a failure of the spring. A body that respawned, or whose owner dropped for a second, is metres out — and a spring strong enough to fix that in one tick is a spring that would fling everything else across the level. Past the threshold it is teleported, and the teleport is marked so the receiver's own interpolation does not smear it.
Fields and properties (5)
public NetworkRulesRegistry? RulesWho decides what, and who this peer is. See the capture system's remarks.
public PlayerId LocalWhich player this peer is, or None for a server.
public SystemAccess AccessWhat this system reads and writes.
public long CorrectedCountHow many bodies have been nudged toward the authority.
public long SnappedCountHow many were too far out to nudge and were snapped.
Methods (3)
public override JobHandle Update(in SystemContext context, JobHandle dependency)Runs the system.
public void Correct(World world, float step)Corrects every body that is not simulated here.
public bool IsAuthority(NetworkId id)Whether this peer is the one that decides where a body is.
Used by (1)
- NetworkRigidBodyTestsVixen.Net.Physics.Tests