Table of Contents

Class TransformComponent

Namespace
Stride.Engine
Assembly
Stride.Engine.dll

Defines Position, Rotation and Scale of its Entity.

[DataContract("TransformComponent")]
[DataSerializerGlobal(null, typeof(FastCollection<TransformComponent>), DataSerializerGenericMode.None, false, false)]
[DefaultEntityComponentProcessor(typeof(TransformProcessor))]
[Display("Transform", null, Expand = ExpandRule.Once)]
[ComponentOrder(0)]
public sealed class TransformComponent : EntityComponent, IIdentifiable
Inheritance
TransformComponent
Implements
Inherited Members
Extension Methods

Constructors

TransformComponent()

Initializes a new instance of the TransformComponent class.

public TransformComponent()

Fields

LocalMatrix

The local matrix. Its value is automatically recomputed at each frame from the position, rotation and scale. One can use UpdateLocalMatrix() to force the update to happen before next frame.

public Matrix LocalMatrix

Field Value

Matrix

Remarks

The setter should not be used and is accessible only for performance purposes.

Position

The translation relative to the parent transformation.

[DataMember(10)]
public Vector3 Position

Field Value

Vector3

PostOperations

This is where we can register some custom work to be done after world matrix has been computed, such as updating model node hierarchy or physics for local node.

public FastListStruct<TransformOperation> PostOperations

Field Value

FastListStruct<TransformOperation>

Rotation

The rotation relative to the parent transformation.

[DataMember(20)]
public Quaternion Rotation

Field Value

Quaternion

Scale

The scaling relative to the parent transformation.

[DataMember(30)]
public Vector3 Scale

Field Value

Vector3
public TransformLink TransformLink

Field Value

TransformLink

WorldMatrix

The world matrix. Its value is automatically recomputed at each frame from the local and the parent matrices. One can use UpdateWorldMatrix() to force the update to happen before next frame.

public Matrix WorldMatrix

Field Value

Matrix

Remarks

The setter should not be used and is accessible only for performance purposes.

Properties

Children

Gets the children of this TransformComponent.

public FastCollection<TransformComponent> Children { get; }

Property Value

FastCollection<TransformComponent>

Parent

Gets or sets the parent of this TransformComponent.

public TransformComponent Parent { get; set; }

Property Value

TransformComponent

The parent.

RotationEulerXYZ

Gets or sets the euler rotation, with XYZ order. Not stable: setting value and getting it again might return different value as it is internally encoded as a Quaternion in Rotation.

public Vector3 RotationEulerXYZ { get; set; }

Property Value

Vector3

The euler rotation.

UseTRS

Gets or sets a value indicating whether to use the Translation/Rotation/Scale.

[Display(null, null, Browsable = false)]
public bool UseTRS { get; set; }

Property Value

bool

true if [use TRS]; otherwise, false.

Methods

UpdateLocalFromWorld()

Updates the local matrix based on the world matrix and the parent entity's or containing scene's world matrix.

public void UpdateLocalFromWorld()

UpdateLocalMatrix()

Updates the local matrix. If UseTRS is true, LocalMatrix will be updated from Position, Rotation and Scale.

public void UpdateLocalMatrix()

UpdateWorldMatrix()

Updates the world matrix. It will first call UpdateLocalMatrix() on self, and UpdateWorldMatrix() on Parent if not null. Then WorldMatrix will be updated by multiplying LocalMatrix and parent WorldMatrix (if any).

public void UpdateWorldMatrix()