Class Transform3D
Every entity must be a transform derived component. It's used to store and manipulate the position, rotation and scale of the entity.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public class Transform3D : Component, IDependencyObject
Constructors
Transform3D()
Initializes a new instance of the Transform3D class.
Declaration
public Transform3D()
Fields
UpdateCounter
The update counter.
Declaration
public int UpdateCounter
Field Value
Type | Description |
---|---|
int |
childrenTransform
Transforms of the children entities.
Declaration
protected List<Transform3D> childrenTransform
Field Value
Type | Description |
---|---|
List<Transform3D> |
localOrientation
The entity rotation in local space.
Declaration
protected Quaternion localOrientation
Field Value
Type | Description |
---|---|
Quaternion |
localPosition
The entity position in local space.
Declaration
protected Vector3 localPosition
Field Value
Type | Description |
---|---|
Vector3 |
localScale
The entity scale in local space.
Declaration
protected Vector3 localScale
Field Value
Type | Description |
---|---|
Vector3 |
parentTransform
Gets the transform of the parent entity.
Declaration
[BindComponent(false, false, BindComponentSource.ParentsSkipOwner, null, true)]
protected Transform3D parentTransform
Field Value
Type | Description |
---|---|
Transform3D |
Properties
Backward
Gets the entity backward vector in world space.
Declaration
public Vector3 Backward { get; }
Property Value
Type | Description |
---|---|
Vector3 |
ChildrenTransform
Gets the transforms of the children entities.
Declaration
public IEnumerable<Transform3D> ChildrenTransform { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Transform3D> |
Down
Gets the entity down vector in world space.
Declaration
public Vector3 Down { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Forward
Gets the entity forward vector in world space.
Declaration
public Vector3 Forward { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Left
Gets the entity left vector in world space.
Declaration
public Vector3 Left { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalBackward
Gets the entity backward vector in local space.
Declaration
public Vector3 LocalBackward { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalDown
Gets the entity down vector in local space.
Declaration
public Vector3 LocalDown { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalForward
Gets the entity forward vector in local space.
Declaration
public Vector3 LocalForward { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalLeft
Gets the entity left vector in local space.
Declaration
public Vector3 LocalLeft { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalOrientation
Gets or sets the entity rotation in local space.
Declaration
public Quaternion LocalOrientation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
LocalPosition
Gets or sets the entity position in local space.
Declaration
[RenderProperty(CustomPropertyName = "Local Position", Tooltip = "The entity position in local space")]
public Vector3 LocalPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalRight
Gets the entity right vector in local space.
Declaration
public Vector3 LocalRight { get; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalRotation
Gets or sets the global rotation expressed in Euler angles (yaw, pitch, roll).
Declaration
[RenderProperty(typeof(Vector3RadianToDegreeConverter), CustomPropertyName = "Local Rotation", Tooltip = "The global rotation expressed in Euler angles (yaw, pitch, roll)")]
public Vector3 LocalRotation { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalScale
Gets or sets the entity scale in local space.
Declaration
[RenderProperty(CustomPropertyName = "Local Scale", Tooltip = "The entity scale in local space")]
public Vector3 LocalScale { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
LocalTransform
Gets or sets the matrix transform relative to the parent transform.
Declaration
public Matrix4x4 LocalTransform { get; set; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
LocalUp
Gets the entity up vector in local space.
Declaration
public Vector3 LocalUp { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Orientation
Gets or sets the entity rotation in world space.
Declaration
public Quaternion Orientation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
ParentTransform
Gets the transform of the parent entity.
Declaration
public Transform3D ParentTransform { get; }
Property Value
Type | Description |
---|---|
Transform3D |
Position
Gets or sets the entity position in world space.
Declaration
public Vector3 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Right
Gets the entity right vector in world space.
Declaration
public Vector3 Right { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Rotation
Gets or sets the global rotation expressed in Euler angles (yaw, pitch, roll).
Declaration
public Vector3 Rotation { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Scale
Gets or sets the entity scale in world space.
Declaration
public Vector3 Scale { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Up
Gets the entity up vector in world space.
Declaration
public Vector3 Up { get; }
Property Value
Type | Description |
---|---|
Vector3 |
WorldInverseTransform
Gets the inverse of the matrix that transform from local space to world space.
Declaration
public Matrix4x4 WorldInverseTransform { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
WorldToLocalTransform
Gets the matrix that transform from world space to local space.
Declaration
public Matrix4x4 WorldToLocalTransform { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
WorldTransform
Gets or sets the matrix that transform from local space to world space.
Declaration
public Matrix4x4 WorldTransform { get; set; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Methods
LocalLookAt(Vector3, Vector3, bool)
Rotates the entity to point to the specified position and up vector (in Local space).
Declaration
public void LocalLookAt(Vector3 targetPosition, Vector3 up, bool forward = true)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | targetPosition | The world position to look at. |
Vector3 | up | The up vector. |
bool | forward | If set to |
LookAt(Vector3)
Rotates the entity to point to the specified position and up vector.
Declaration
public void LookAt(Vector3 targetPosition)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | targetPosition | The world position to look at. |
LookAt(Vector3, Vector3, bool)
Rotates the entity to point to the specified position and up vector (in World space).
Declaration
public void LookAt(Vector3 targetPosition, Vector3 up, bool forward = true)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | targetPosition | The world position to look at. |
Vector3 | up | The up vector. |
bool | forward | If set to |
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if all is OK. |
Overrides
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
ResetDirtyFlags()
Reset dirty flags.
Declaration
protected virtual void ResetDirtyFlags()
RotateAround(Vector3, Quaternion)
Rotates the entity respect the point using the quaternion.
Declaration
public void RotateAround(Vector3 point, Quaternion quaternion)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The center of rotation. |
Quaternion | quaternion | The rotation specified as a quaternion. |
RotateAround(Vector3, Vector3, float)
Rotates the entity respect the point using an axis and angle.
Declaration
public void RotateAround(Vector3 point, Vector3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The center of rotation. |
Vector3 | axis | The axis of rotation. |
float | angle | The angle of rotation. |
RotateAround(ref Vector3, ref Quaternion)
Rotates the entity respect the point using the quaternion.
Declaration
public void RotateAround(ref Vector3 point, ref Quaternion quaternion)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The center of rotation. |
Quaternion | quaternion | The rotation specified as a quaternion. |
RotateAround(ref Vector3, ref Vector3, float)
Rotates the entity respect the point using an axis and angle.
Declaration
public void RotateAround(ref Vector3 point, ref Vector3 axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The center of rotation. |
Vector3 | axis | The axis of rotation. |
float | angle | The angle of rotation. |
SetLocalTransform(Vector3, Quaternion, Vector3)
Set the local transform.
Declaration
public void SetLocalTransform(Vector3 localPosition, Quaternion localOrientation, Vector3 localScale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | localPosition | The local position. |
Quaternion | localOrientation | The local orientation. |
Vector3 | localScale | The local scale. |
SetLocalTransform(ref Vector3, ref Quaternion, ref Vector3)
Set the local transform.
Declaration
public void SetLocalTransform(ref Vector3 localPosition, ref Quaternion localOrientation, ref Vector3 localScale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | localPosition | The local position. |
Quaternion | localOrientation | The local orientation. |
Vector3 | localScale | The local scale. |
Events
LocalOrientationChanged
Event fired when this transform Local rotation is changed
Declaration
public event EventHandler LocalOrientationChanged
Event Type
Type | Description |
---|---|
EventHandler |
LocalPositionChanged
Event fired when this transform Local position is changed
Declaration
public event EventHandler LocalPositionChanged
Event Type
Type | Description |
---|---|
EventHandler |
LocalScaleChanged
Event fired when this transform Local scale is changed
Declaration
public event EventHandler LocalScaleChanged
Event Type
Type | Description |
---|---|
EventHandler |
LocalTransformChanged
Event fired when this Local transform is changed
Declaration
public event EventHandler LocalTransformChanged
Event Type
Type | Description |
---|---|
EventHandler |
OrientationChanged
Event fired when this transform rotation is changed
Declaration
public event EventHandler OrientationChanged
Event Type
Type | Description |
---|---|
EventHandler |
PositionChanged
Event fired when this transform position is changed
Declaration
public event EventHandler PositionChanged
Event Type
Type | Description |
---|---|
EventHandler |
ScaleChanged
Event fired when this transform scale is changed
Declaration
public event EventHandler ScaleChanged
Event Type
Type | Description |
---|---|
EventHandler |
TransformChanged
Event fired when this transform is changed
Declaration
public event EventHandler TransformChanged
Event Type
Type | Description |
---|---|
EventHandler |