Transform

Description

The position / rotation / scale of an Entity. Every mutating setter flips _changed and calls parent.MarkDirty(), so changing a transform automatically queues the entity for a GPU re-upload. Rotation is stored as Euler degrees; GetQuaternion() converts on demand.

API summary

MemberKindSummary
SetWorldPosition(Vector3D)publicSet absolute position.
MoveToPosition(Vector3D)publicMove to a position and drag children along.
SetLocalPosition(Vector3D) / MoveLocalPosition(Vector3D)publicOffset by a delta (the Move* variant also offsets children).
SetWorldScale / SetLocalScale(Vector3D)publicSet scale.
SetRotationFromVector3(Vector3D)publicSet Euler-degree rotation.
GetQuaternion()publicEuler degrees → Quaternion.
GetEntityPosition() / GetEntityRotation() / GetScale()publicAccessors.

Fields & Properties

[@Serializable] public Vector3D<float> position = new(0, 0, 0);
[@Serializable] public Vector3D<float> rotation = new(0, 0, 0);   // Euler degrees
[@Serializable] public Vector3D<float> scale    = new(1, 1, 1);

[NonSerializable] internal Entity parent;
[@Serializable]   internal bool _changed = false;

Methods

Position

SetWorldPosition overwrites; SetLocalPosition / MoveLocalPosition add a delta. MoveLocalPosition recurses into children so they follow the parent.

Scale / Rotation

SetLocalScale / SetWorldScale set scale directly. Rotation is set via SetRotationFromVector3 (degrees) and read back as a quaternion via GetQuaternion().

Notes / gotchas

  • SetRotationFromQuaternion(q) currently only calls MarkDirty() — it does not store the quaternion, so it has no visible effect yet.
  • MoveToPosition computes its child delta after overwriting position, so the delta is always zero and children don’t actually move. Use MoveLocalPosition if you need children to follow.

Helpers

private float DegreesToRadians(float degrees) => degrees * (MathF.PI / 180f);
  • Entity — owns one Transform