Vixen
02b45cc4
csharp
public sealed class NetworkRigidBodyReplicator

Puts a networked body's motion on the wire beside its transform.

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

Remarks

Its own replicator rather than fields on NetworkTransformReplicator, for the reason the delta encoder rewards: a component is the unit of change, and a body's position changes every tick while its rest flag changes twice in a match. Folding them together would mean the flag's lane paying attention every time the body moved.

Unreliable, like the transform beside it. A velocity that was missed is superseded by the next one a thirtieth of a second later, and the correction spring is what covers the gap — which is precisely what it is for.

Fields and properties (9)

  • public const int VelocityBits

    How many bits each velocity axis costs.

  • public static QuantizeRange VelocityRange

    The range a replicated velocity lives in, in metres or radians a second.

  • public ComponentTypeId ComponentType

    Which component this replicates.

  • public uint TypeId

    The id this type has on the wire: a hash of its full name, computed at build time.

  • public string TypeName

    The name, for diagnostics and for the bandwidth attribution panel.

  • public Channel Channel

    How to send it.

  • public int Priority

    Below the transform's. A body whose position arrived without its velocity is drawn in the right place and carried badly for one tick; the other way round it is carried well to the wrong place.

  • public QueryDescription ChangedQuery

    A query matching entities with this component, filtered on it having changed.

  • public ReadOnlySpan<WireLane> Lanes

    The fixed-width fields Write produces, in the order it produces them.

Methods (3)

  • public bool Has(World world, Entity entity)

    Whether an entity has this component at all.

  • public void Write(World world, Entity entity, ref BitWriter writer)

    Encodes an entity's component.

  • public bool Apply(World world, Entity entity, ref BitReader reader)

    Decodes a component and puts it on an entity, adding it if it is not there.

Used by (1)

  • NetworkRigidBodyTestsVixen.Net.Physics.Tests