struct

TransformComponent

Module
Components
Header
#include "Components/TransformComponent.h"
Namespace
Mowo
Reflection
Reflected by MowoHeaderTool

Properties

TypeNameDescription
Vec3positionShown as UE's "Location"; the key stays "position".
Vec3rotationStored in radians, edited in degrees. The inspector reads that off the unit rather than off this component's name, which is what it did before.
Vec3scale
EMobilitymobilityDefault EMobility::Movable.
Mat4worldMatrixComputed by TransformSystem each frame
Vec3lastPositionMirror of the local fields as of the last TransformSystem pass. The next pass memcmps them against the live fields to skip clean subtrees, so there is no MarkDirty() — plain field writes are detected. NaN init forces a full rebuild on the first frame. Default Vec3(std::numeric_limits<float>::quiet_NaN()).
Vec3lastRotationDefault Vec3(std::numeric_limits<float>::quiet_NaN()).
Vec3lastScaleDefault Vec3(std::numeric_limits<float>::quiet_NaN()).
uint32_tworldVersionworldVersion bumps on every worldMatrix rebuild; children compare it against lastParentVersion to catch a moved parent (their own local fields are unchanged but their world position is stale). Default 0.
uint32_tlastParentVersionDefault 0.
uint32_tshadowSeenVersionThe worldVersion the shadow pass last saw and the render frame it last changed on: a Movable caster that moved recently draws in the dynamic shadow layer instead of invalidating the cached static one. Default 0.
uint32_tshadowMovedFrameDefault 0.
EntityIDlastParentThe parent worldMatrix was last composed against. Versions are per-entity counters, so a child moved to a new parent whose version happens to equal the old one's — or unparented, with no parent version left to compare — kept the old parent's world matrix without this. Default INVALID_ENTITY.
uint32_tfirstChildSlotHintWorld slot hints for the RelationshipComponent links TransformSystem follows (this entity's first child, its next sibling), so the hierarchy walk reaches a child without the id → slot hash. Checked against the id on every use; a stale or copied hint just costs the hash once. Default UINT32_MAX.
uint32_tnextSiblingSlotHintDefault UINT32_MAX.

Constructors

SignatureNameDescription
TransformComponent() : position(0.0f, 0.0f, 0.0f), rotation(0.0f, 0.0f, 0.0f), s…TransformComponent
explicit TransformComponent(const Vec3& pos) : position(pos), rotation(0.0f, 0.0…TransformComponent
TransformComponent(const Vec3& pos, const Vec3& rot) : position(pos), rotation(r…TransformComponent
TransformComponent(const Vec3& pos, const Vec3& rot, const Vec3& scl) : position…TransformComponent

Public functions

ReturnsNameDescription
voidTranslate
floatGetScaleX
Mat4GetLocalMatrixOrder: Scale -> RotZ -> RotY -> RotX -> Translate, i.e.
Mat4GetMatrixLocal only — parented entities need GetWorldMatrix().
Mat4GetWorldMatrixBaked by TransformSystem each frame.
Vec3GetWorldPositionExtracted from worldMatrix, so it includes the parent transform.
Vec3GetForwardBasis columns of R = Rx * Ry * Rz — the exact rotation GetLocalMatrix bakes and Quat::FromEuler/ToEuler round-trip, so a decomposed quat (actor sync, physics, imports) yields the same vectors as the quat itself.
Vec3GetRightRight is +X: R * (1, 0, 0) — roll participates here.
Vec3GetUp

Function details

TransformComponent

C++
TransformComponent() : position(0.0f, 0.0f, 0.0f), rotation(0.0f, 0.0f, 0.0f), scale(1.0f, 1.0f, 1.0f), worldMatrix(1.0f)

TransformComponent

C++
explicit TransformComponent(const Vec3& pos) : position(pos), rotation(0.0f, 0.0f, 0.0f), scale(1.0f, 1.0f, 1.0f)

TransformComponent

C++
TransformComponent(const Vec3& pos, const Vec3& rot) : position(pos), rotation(rot), scale(1.0f, 1.0f, 1.0f)

TransformComponent

C++
TransformComponent(const Vec3& pos, const Vec3& rot, const Vec3& scl) : position(pos), rotation(rot), scale(scl)

Translate

C++
void Translate(Vec3 delta)

GetScaleX

C++
float GetScaleX() const

GetLocalMatrix

C++
Mat4 GetLocalMatrix() const

Order: Scale -> RotZ -> RotY -> RotX -> Translate, i.e. T * Rx * Ry * Rz * S, composed analytically: the 3x3 block is Rx*Ry*Rz expanded with its columns scaled, ~30 ops instead of four Mat4 products. Rounding differs from the matrix product only in op order; equivalence is locked by --trs-test.

GetMatrix

C++
Mat4 GetMatrix() const

Local only — parented entities need GetWorldMatrix().

GetWorldMatrix

C++
Mat4 GetWorldMatrix() const

Baked by TransformSystem each frame. For root entities == GetLocalMatrix().

GetWorldPosition

C++
Vec3 GetWorldPosition() const

Extracted from worldMatrix, so it includes the parent transform.

GetForward

C++
Vec3 GetForward() const

Basis columns of R = Rx * Ry * Rz — the exact rotation GetLocalMatrix bakes and Quat::FromEuler/ToEuler round-trip, so a decomposed quat (actor sync, physics, imports) yields the same vectors as the quat itself. Forward = R * (0, 0, -1); the -Z column has no roll terms.

GetRight

C++
Vec3 GetRight() const

Right is +X: R * (1, 0, 0) — roll participates here.

GetUp

C++
Vec3 GetUp() const
Generated from Components/TransformComponent.h via components.json · Oct 26, 2026Version 1.0.0