Vixen
02b45cc4

NetworkTransformCaptureSystem

system Core/Vixen.Net.Engine/NetworkTransformBridge.cs:53
csharp
public sealed class NetworkTransformCaptureSystem

Copies the engine's transform into the one the network sends.

No guide page documents this yet — the page shows what the code says about itself.

As a system

Phase
FixedUpdate

Remarks

The seam doc 16 said Vixen.Engine and Vixen.Net would first have to meet at. Everything above the wire speaks LocalTransform; everything on it speaks NetworkTransform. Something has to copy between them, and until now that something was every game that wanted a physics object networked.

The direction depends on which peer this is, and getting that wrong is not subtle for long. A server owns the truth and publishes it, so it copies transform → network. A client receives the truth and displays it, so it copies network → transform. A single system that did both would have each end overwriting the other every tick; on a client with physics it also means the solver and the network fighting over the same body, which looks like the object vibrating. Hence two systems, and a peer registers one of them.

It costs nothing when nothing moved. The query is filtered on WithChanged<LocalTransform> and the sweep starts from the version last seen, so a scene of a thousand sleeping props visits none of them. That is the same mechanism TransformSystem uses and the reason the ECS carries change versions at all.

Fields and properties (3)

  • public SystemAccess Access
  • public long PublishedCount

    How many transforms have been published.

  • public long TeleportCount

    How many teleports have been turned into a counter bump.

Methods (2)

  • public override JobHandle Update(in SystemContext context, JobHandle dependency)

    Runs the system.

  • public void Publish(World world)

    Publishes every transform that moved, and no others.

Used by (4)

  • NetworkRigidBodyCaptureSystemVixen.Net.Physics
  • NetworkTransformBridgeTestsVixen.Net.Engine.Tests
  • PredictedPlayerMovementVixen.Net.Physics
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests