KernelAPI reference
Struct Transform
Namespace: MicroEngine.Scenes
Assembly: MicroEngine.Scene.dll
Guide: Scenes
Position, rotation and scale relative to the parent (or to the world for a root entity). Stored in 3D; 2D games use
the 2D helpers, which read and write X/Y and the rotation about Z. default is degenerate (zero scale and
a zero quaternion): entities start at Identity.
public struct TransformFields
Position
Translation.
public Vector3 PositionField Value
Rotation
Rotation (unit quaternion).
public Quaternion RotationField Value
Scale
Scale per axis.
public Vector3 ScaleField Value
Properties
Identity
No translation, no rotation, unit scale.
public static Transform Identity { get; }Property Value
Position2D
X and Y of Position; writing keeps Z. Exact: a written value reads back bit for bit.
public Vector2 Position2D { readonly get; set; }Property Value
Rotation2D
The rotation about Z in radians. Writing replaces Rotation; reading converts back from the quaternion, so a written angle reads back within a few ulps, not bit for bit (keep the angle in game state when the exact value matters).
public float Rotation2D { readonly get; set; }Property Value
Scale2D
X and Y of Scale; writing keeps Z.
public Vector2 Scale2D { readonly get; set; }Property Value
Methods
Interpolate(in Transform, in Transform, float)
The transform t of the way from from to to: positions and
scales lerp, rotations slerp. Returns to exactly when t is 1 or more or the
two are equal, so a fixed-step run draws exactly the simulated state.
public static Transform Interpolate(in Transform from, in Transform to, float t)Parameters
from Transform
to Transform
t float
Returns
ToMatrix()
The matrix that maps this transform’s space to its parent’s (scale, then rotate, then translate).
public readonly Matrix4x4 ToMatrix()