Skip to content

Game.Rendering.InterpolatedTransform

Assembly:
Game (assembly inferred from project layout)

Namespace:
Game.Rendering

Type:
struct

Base:
System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable)

Summary:
Represents a lightweight, serializable interpolated transform used by the rendering pipeline. Stores position, rotation and a small flags value. Intended to be used as an ECS component (IComponentData) and to be passed to queries (IQueryTypeParameter). The struct is suitable for use in jobs and serialization contexts (IEmptySerializable).


Fields

  • public Unity.Mathematics.float3 m_Position
    Holds the world position of the transform. Uses Unity.Mathematics.float3 for tight memory layout and performance in jobs.

  • public Unity.Mathematics.quaternion m_Rotation
    Holds the world rotation as a quaternion. Uses Unity.Mathematics.quaternion for efficient math and job compatibility.

  • public TransformFlags m_Flags
    Small flags field (enum) for additional transform metadata/behavior. Constructors in this file initialize it to zero (no flags set).

Properties

  • (none)
    This struct exposes only public fields; there are no CLR properties.

Constructors

  • public InterpolatedTransform(Transform transform)
    Initializes the component from a Game.Objects.Transform instance. Copies position and rotation from the source Transform and sets m_Flags to 0.

  • public InterpolatedTransform(WeatherPhenomenon weatherPhenomenon)
    Initializes the component from a WeatherPhenomenon instance. Copies the hotspot position into m_Position, sets rotation to quaternion.identity and m_Flags to 0. Useful for treating weather phenomena as renderable entities.

Remarks: the default parameterless constructor (struct default) will zero all fields (position = 0, rotation = identity? — actually quaternion zero; code uses the explicit constructors for meaningful values).

Methods

  • public Transform ToTransform()
    Converts this InterpolatedTransform into a Game.Objects.Transform by creating and returning a new Transform with the stored position and rotation. Useful when code consuming rendering data needs the higher-level Transform type.

Behavior notes: - This is a simple value conversion; it does not copy or apply any flags. - Because this is a struct, conversions are value copies — pay attention to copies in tight loops or jobs.

Usage Example

// Create from an existing Transform
var worldTransform = new Game.Objects.Transform(new float3(10f, 0f, 5f), quaternion.identity);
var interp = new Game.Rendering.InterpolatedTransform(worldTransform);

// Create from a WeatherPhenomenon
// (assume 'phenomenon' is a WeatherPhenomenon instance)
var weatherInterp = new Game.Rendering.InterpolatedTransform(phenomenon);

// Convert back to Game.Objects.Transform for API that expects it
Game.Objects.Transform t = interp.ToTransform();

Additional notes for modders: - Because this struct implements IComponentData, it is intended to be attached to ECS entities. Use it in entity archetypes for renderable objects that require interpolation. - Implemented interfaces make it suitable for query usage and serialization by the game's systems; avoid adding non-blittable fields. - m_Flags is initialized to zero by the provided constructors — check the definition of TransformFlags in the project to know which bits can be set and how they affect rendering/behavior.