Get SpatialOS

Sites

Menu

How the Transform Synchronization Feature Module works

What is transform

The transform of an entity describes its location and rotation. Worker-instances generally use it to run physics simulations or render entities for a client. Note that the SpatialOS representation of transform is not the same as Unity’s representation of transform.

In the Transform Synchronization Feature Module, we represent the Transform as:

package improbable.transform;

type Location {
    float x = 1;
    float y = 2;
    float z = 3;
}

type Velocity {
    float x = 1;
    float y = 2;
    float z = 3;
}

type Quaternion {
    float w = 1;
    float x = 2;
    float y = 3;
    float z = 4;
}

component TransformInternal {
    id = 11000;
    Location location = 1;
    Quaternion rotation = 2;
    Velocity velocity = 3;
    uint32 physics_tick = 4;
    float ticks_per_second = 5;
}

Note: The TransformInternal component contains additional fields such as velocity and physics_tick. These are implementation details of the Transform Synchronization Feature Module.

How do my entities’ transform get synchronized

The behaviour of the Transform Synchronization Feature Modules differs depending on whether your worker-instance is authoritative over the TransformInternal and Position components. This behaviour can be adjusted with transform synchronization strategies, but broadly goes as follows:

On authoritative worker-instances

The Transform Synchronization Feature Module listens for changes in the native Unity transform representation (UnityEngine.Transform or UnityEngine.Rigidbody) and translates these into TransformInternal and Position component updates.

This means that, as a user, you shouldn’t manually update the TransformInternal or Position components. You can simply move your GameObjects as you normally would and these changes will be synchronized as specified in the applied strategy.

On non-authoritative worker-instances

The Transform Synchronization Feature Module listens for SpatialOS component updates in the TransformInternal component and applies these changes to the native Unity transform representation (UnityEngine.Transform or UnityEngine.Rigidbody) as specified in the applied strategy.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums