Class TransformDataLoggable
An IDataLoggable component that captures the world-space position, rotation, and scale of this GameObject's Transform each time data is collected.
[DisallowMultipleComponent]
public class TransformDataLoggable : MonoBehaviour, IDataLoggable
Inheritance
Implements
Examples
// Attach TransformDataLoggable to any actor whose position you want to track.
// The DataCollector on the same GameObject will call Collect() automatically.
public class TrackableActor : MonoBehaviour
{
// Ensure both TransformDataLoggable and DataCollector are on this prefab.
}
Remarks
Attach this component alongside a DataCollector to automatically log transform snapshots at each collection interval. Collection is skipped when the component is disabled.
Why world-space: Post-session trajectory reconstruction requires absolute positions in the scene coordinate system. Local-space coordinates would be meaningless if the actor is reparented during the scenario (for example, a pedestrian boarding a vehicle), because the origin of the local frame would shift and the logged values would no longer correspond to consistent world locations.
Methods
Collect()
Collects a snapshot of this transform's position, rotation, and scale.
Returns null when the component is disabled, signalling the collector to skip this entry.
public DataLog Collect()
Returns
DataLog — A TransformDataLog containing the current world-space transform data, or null if disabled.
Remarks
The early-out on enabled == false prevents stale or zeroed values from a
temporarily inactive actor from poisoning the trajectory log. If a disabled component
returned a snapshot anyway, post-session analysis tools would see the actor teleport
to the origin (or freeze at its last position) during the inactive period, producing
artefacts in speed, heading, and proximity calculations.