Scripting API
Scripting API
Transform
Struct in Abyss.Core, from Abyss.Core.
An entity's position, rotation and scale relative to its parent.
public struct TransformRemarks
This is a mirror of Bevy's Transform, not of one the engine declares. That matters: Bevy's is #[repr(Rust)], so the compiler chooses the field order, and it does not choose the declared one. glam::Quat is a sixteen-byte SIMD register, so the quaternion is hoisted to offset 0 and the struct is 48 bytes aligned to 16 — not the ten floats' worth of 40 aligned to 4 that reading the Rust definition suggests.
The fields below are therefore in storage order rather than declaration order, and nothing takes that on trust: World.Transform checks every offset against the table the engine recovered from the Rust compiler before it hands back an id. A Bevy upgrade, a glam upgrade or a different optimization level that moved a field would be a startup error naming the field, rather than a silent misread of every entity in the world.
The zero value is not the identity. Components in this engine spawn zeroed, and a zeroed transform has zero scale and a zero quaternion — neither is meaningful. Use Transform.Identity when filling a spawn batch. An entity left zeroed sits at the origin with no size, which is wrong in a way you can see rather than a way you cannot.
Propagation is not in your schedule. GlobalTransform is computed by Bevy's own systems in its PostUpdate, so what runs them is World.RunBevyFrame or the windowed loop — not Schedule.Run. A frame that writes transforms and never runs a Bevy frame will never see them resolved.
Properties
RotationX
public float RotationX { readonly get; set; }Rotation quaternion, x component.
RotationY
public float RotationY { readonly get; set; }Rotation quaternion, y component.
RotationZ
public float RotationZ { readonly get; set; }Rotation quaternion, z component.
RotationW
public float RotationW { readonly get; set; }Rotation quaternion, w component.
Identity
public static Transform Identity { get; }No translation, no rotation, unit scale.
Fields
Rotation
public Vector128<float> RotationRotation as a quaternion, in x, y, z, w order.
A whole SIMD lane rather than four floats, because that is what it is in Rust and what gives this struct the sixteen-byte alignment Bevy's has. Build one with Vector128.Create(x, y, z, w); read the parts with Transform.RotationX and its neighbors.
TranslationX
public float TranslationXOffset from the parent's origin.
TranslationY
public float TranslationYOffset from the parent's origin.
TranslationZ
public float TranslationZOffset from the parent's origin.
ScaleX
public float ScaleXScale along the x axis.
ScaleY
public float ScaleYScale along the y axis.
ScaleZ
public float ScaleZScale along the z axis.
