Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::TransformInterface Class Referenceabstract

#include <TransformBus.h>

Inherits AZ::ComponentBus.

Public Member Functions

 AZ_RTTI (TransformInterface, "{8DD8A4E2-7F61-4A36-9169-A31F03E25FEB}")
 
virtual ~TransformInterface ()=default
 Destroys the instance of the class.
 
virtual OnParentChangedBehavior GetOnParentChangedBehavior ()
 Get the behavior at runtime when this entity's parent's transform changes.
 
virtual void SetOnParentChangedBehavior (OnParentChangedBehavior onParentChangedBehavior)
 Set the behavior at runtime when this entity's parent's transform changes.
 
virtual void BindTransformChangedEventHandler (TransformChangedEvent::Handler &handler)=0
 
virtual void BindParentChangedEventHandler (ParentChangedEvent::Handler &handler)=0
 
virtual void BindChildChangedEventHandler (ChildChangedEvent::Handler &handler)=0
 
virtual void NotifyChildChangedEvent (ChildChangeType changeType, EntityId entityId)=0
 
virtual const TransformGetLocalTM ()=0
 
virtual void SetLocalTM (const Transform &tm)
 
virtual const TransformGetWorldTM ()=0
 
virtual void SetWorldTM (const Transform &tm)
 
virtual void GetLocalAndWorld (Transform &localTM, Transform &worldTM)
 
virtual void SetWorldTranslation (const AZ::Vector3 &newPosition)
 
virtual void SetLocalTranslation (const AZ::Vector3 &newPosition)
 
virtual AZ::Vector3 GetWorldTranslation ()
 
virtual AZ::Vector3 GetLocalTranslation ()
 
virtual void MoveEntity (const AZ::Vector3 &offset)
 
virtual void SetWorldX (float x)
 
virtual void SetWorldY (float y)
 
virtual void SetWorldZ (float z)
 
virtual float GetWorldX ()
 
virtual float GetWorldY ()
 
virtual float GetWorldZ ()
 
virtual void SetLocalX (float x)
 
virtual void SetLocalY (float y)
 
virtual void SetLocalZ (float z)
 
virtual float GetLocalX ()
 
virtual float GetLocalY ()
 
virtual float GetLocalZ ()
 
virtual void SetWorldRotation (const AZ::Vector3 &eulerAnglesRadian)
 
virtual void SetWorldRotationQuaternion (const AZ::Quaternion &quaternion)
 
virtual AZ::Vector3 GetWorldRotation ()
 
virtual AZ::Quaternion GetWorldRotationQuaternion ()
 
virtual void SetLocalRotation (const AZ::Vector3 &eulerRadianAngles)
 
virtual void SetLocalRotationQuaternion (const AZ::Quaternion &quaternion)
 
virtual void RotateAroundLocalX (float eulerAngleRadian)
 
virtual void RotateAroundLocalY (float eulerAngleRadian)
 
virtual void RotateAroundLocalZ (float eulerAngleRadian)
 
virtual AZ::Vector3 GetLocalRotation ()
 
virtual AZ::Quaternion GetLocalRotationQuaternion ()
 
virtual AZ::Vector3 GetLocalScale ()
 
virtual void SetLocalUniformScale (float scale)
 Set the uniform scale value in local space.
 
virtual float GetLocalUniformScale ()
 
virtual float GetWorldUniformScale ()
 
virtual EntityId GetParentId ()
 
virtual TransformInterfaceGetParent ()
 
virtual void SetParent (EntityId id)
 
virtual void SetParentRelative (EntityId id)
 
virtual AZStd::vector< AZ::EntityIdGetChildren ()
 
virtual AZStd::vector< AZ::EntityIdGetAllDescendants ()
 
virtual AZStd::vector< AZ::EntityIdGetEntityAndAllDescendants ()
 
virtual bool IsStaticTransform ()=0
 
virtual void SetIsStaticTransform (bool isStatic)
 
- Public Member Functions inherited from AZ::ComponentBus
virtual ~ComponentBus ()=default
 

Static Public Attributes

static const EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Single
 Overrides the default AZ::EBusTraits handler policy to allow one listener only.
 
- Static Public Attributes inherited from AZ::ComponentBus
static const EBusAddressPolicy AddressPolicy = EBusAddressPolicy::ById
 
- Static Public Attributes inherited from AZ::EBusTraits
static constexpr EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Multiple
 
static constexpr EBusAddressPolicy AddressPolicy = EBusAddressPolicy::Single
 
static constexpr bool EnableEventQueue = false
 
static constexpr bool EventQueueingActiveByDefault = true
 
static constexpr bool EnableQueuedReferences = false
 
static constexpr bool LocklessDispatch = false
 

Additional Inherited Members

- Public Types inherited from AZ::ComponentBus
typedef EntityId BusIdType
 
- Public Types inherited from AZ::EBusTraits
using AllocatorType = AZ::Internal::EBusEnvironmentAllocator
 
using BusIdType = NullBusId
 
using BusIdOrderCompare = NullBusIdCompare
 
using BusHandlerOrderCompare = BusHandlerCompareDefault
 
using MutexType = NullMutex
 
using EventQueueMutexType = NullMutex
 
template<class Bus >
using ConnectionPolicy = EBusConnectionPolicy< Bus >
 
template<class Context >
using StoragePolicy = EBusEnvironmentStoragePolicy< Context >
 
template<class Bus >
using RouterPolicy = EBusRouterPolicy< Bus >
 
using EventProcessingPolicy = EBusEventProcessingPolicy
 
template<typename DispatchMutex , bool IsLocklessDispatch>
using DispatchLockGuard = AZStd::conditional_t< IsLocklessDispatch, AZ::Internal::NullLockGuard< DispatchMutex >, AZStd::scoped_lock< DispatchMutex > >
 
template<typename ContextMutex >
using ConnectLockGuard = AZStd::conditional_t< AZStd::is_same_v< ContextMutex, AZ::NullMutex >, AZ::Internal::NullLockGuard< ContextMutex >, AZStd::unique_lock< ContextMutex > >
 
template<typename ContextMutex >
using BindLockGuard = AZStd::scoped_lock< ContextMutex >
 
template<typename ContextMutex >
using CallstackTrackerLockGuard = AZStd::conditional_t< AZStd::is_same_v< ContextMutex, AZ::NullMutex >, AZ::Internal::NullLockGuard< ContextMutex >, AZStd::unique_lock< ContextMutex > >
 
- Protected Member Functions inherited from AZ::EBusTraits
 ~EBusTraits ()=default
 

Detailed Description

Interface for AZ::TransformBus, which is an EBus that receives requests to translate (position), rotate, and scale an entity in 3D space. It also receives requests to get and set the parent of an entity and get the descendants of an entity.

An entity's local transform is the entity's position relative to its parent entity. An entity's world transform is the entity's position within the entire game space.

Member Function Documentation

◆ BindChildChangedEventHandler()

virtual void AZ::TransformInterface::BindChildChangedEventHandler ( ChildChangedEvent::Handler handler)
pure virtual

Binds the provided ChildChangedEvent handler to the TransformComponent.

Parameters
handlerthe handler to invoke when the entity has a child entity added or removed

◆ BindParentChangedEventHandler()

virtual void AZ::TransformInterface::BindParentChangedEventHandler ( ParentChangedEvent::Handler handler)
pure virtual

Binds the provided ParentChangedEvent to the TransformComponent.

Parameters
handlerthe handler to invoke when the entities parent changes

◆ BindTransformChangedEventHandler()

virtual void AZ::TransformInterface::BindTransformChangedEventHandler ( TransformChangedEvent::Handler handler)
pure virtual

Event handlers

Binds the provided TransformChangedEvent handler to the TransformComponent.

Parameters
handlerthe handler to invoke when the entities transform changes

◆ GetAllDescendants()

virtual AZStd::vector< AZ::EntityId > AZ::TransformInterface::GetAllDescendants ( )
inlinevirtual

Returns the entityIds of all descendants of the entity. The descendants are the entity's children, the children's children, and so on. The entityIds are ordered breadth-first.

Returns
A vector that contains the entityIds of the descendants.

◆ GetChildren()

virtual AZStd::vector< AZ::EntityId > AZ::TransformInterface::GetChildren ( )
inlinevirtual

Returns the entityIds of the entity's immediate children.

Returns
A vector that contains the entityIds of the entity's immediate children.

◆ GetEntityAndAllDescendants()

virtual AZStd::vector< AZ::EntityId > AZ::TransformInterface::GetEntityAndAllDescendants ( )
inlinevirtual

Returns the entityId of the entity and all its descendants. The descendants are the entity's children, the children's children, and so on. The entityIds are ordered breadth-first and this entity's ID is the first in the list.

Returns
A vector that contains the entityId of the entity followed by the entity IDs of its descendants.

◆ GetLocalAndWorld()

virtual void AZ::TransformInterface::GetLocalAndWorld ( Transform localTM,
Transform worldTM 
)
inlinevirtual

Retrieves the entity's local and world transforms.

Parameters
[out]localTMA reference to a transform that represents the entity's position relative to its parent entity.
[out]worldTMA reference to a transform that represents the entity's position within the world.

◆ GetLocalRotation()

virtual AZ::Vector3 AZ::TransformInterface::GetLocalRotation ( )
inlinevirtual

Get angles in radian for each principle axis around which the local transform is rotated in the order of x-axis and y-axis and then z-axis.

Returns
A value of type Vector3 indicating how much in radian is rotated around each principle axis.

◆ GetLocalRotationQuaternion()

virtual AZ::Quaternion AZ::TransformInterface::GetLocalRotationQuaternion ( )
inlinevirtual

Get the quaternion representing the local rotation.

Returns
The rotation quaternion in local space.

◆ GetLocalScale()

virtual AZ::Vector3 AZ::TransformInterface::GetLocalScale ( )
inlinevirtual

Scale modifiers

Deprecated:
GetLocalScale is deprecated, and is left only to allow migration of legacy vector scale. Get the legacy vector scale value in local space.
Returns
The scale value in local space.

◆ GetLocalTM()

virtual const Transform & AZ::TransformInterface::GetLocalTM ( )
pure virtual

Transform modifiers

Returns the entity's local transform, not including the parent transform.

Returns
A reference to a transform that represents the entity's position relative to its parent entity.

◆ GetLocalTranslation()

virtual AZ::Vector3 AZ::TransformInterface::GetLocalTranslation ( )
inlinevirtual

Gets the entity's local space translation.

Returns
A three-dimensional translation vector.

◆ GetLocalUniformScale()

virtual float AZ::TransformInterface::GetLocalUniformScale ( )
inlinevirtual

Get the uniform scale value in local space.

Returns
The uniform scale value in local space.

◆ GetLocalX()

virtual float AZ::TransformInterface::GetLocalX ( )
inlinevirtual

Gets the entity's X coordinate in local space.

Returns
The entity's X coordinate in local space.

◆ GetLocalY()

virtual float AZ::TransformInterface::GetLocalY ( )
inlinevirtual

Gets the entity's Y coordinate in local space.

Returns
The entity's Y coordinate in local space.

◆ GetLocalZ()

virtual float AZ::TransformInterface::GetLocalZ ( )
inlinevirtual

Gets the entity's Z coordinate in local space.

Returns
The entity's Z coordinate in local space.

◆ GetParent()

virtual TransformInterface * AZ::TransformInterface::GetParent ( )
inlinevirtual

Returns the transform interface of the parent entity.

Returns
A pointer to the transform interface of the parent. Returns a null pointer if no parent is set or the parent entity is not currently activated.

◆ GetParentId()

virtual EntityId AZ::TransformInterface::GetParentId ( )
inlinevirtual

Transform hierarchy

Returns the entityId of the entity's parent.

Returns
The entityId of the parent. The entityId is invalid if the entity does not have a parent with a valid entityId.

◆ GetWorldRotation()

virtual AZ::Vector3 AZ::TransformInterface::GetWorldRotation ( )
inlinevirtual

Get angles in radian for each principle axis around which the world transform is rotated in the order of z-axis and y-axis and then x-axis.

Returns
The Euler angles in radian indicating how much is rotated around each principle axis.

◆ GetWorldRotationQuaternion()

virtual AZ::Quaternion AZ::TransformInterface::GetWorldRotationQuaternion ( )
inlinevirtual

Get the quaternion representing the world rotation.

Returns
The Rotation quaternion in world space.

◆ GetWorldTM()

virtual const Transform & AZ::TransformInterface::GetWorldTM ( )
pure virtual

Returns the entity's world transform, including the parent transform.

Returns
A reference to a transform that represents the entity's position within the world.

◆ GetWorldTranslation()

virtual AZ::Vector3 AZ::TransformInterface::GetWorldTranslation ( )
inlinevirtual

Gets the entity's world space translation.

Returns
A three-dimensional translation vector.

◆ GetWorldUniformScale()

virtual float AZ::TransformInterface::GetWorldUniformScale ( )
inlinevirtual

Get the uniform scale value in world space.

Returns
The uniform scale value in world space.

◆ GetWorldX()

virtual float AZ::TransformInterface::GetWorldX ( )
inlinevirtual

Gets the entity's X coordinate in world space.

Returns
The entity's X coordinate in world space.

◆ GetWorldY()

virtual float AZ::TransformInterface::GetWorldY ( )
inlinevirtual

Gets the entity's Y coordinate in world space.

Returns
The entity's Y coordinate in world space.

◆ GetWorldZ()

virtual float AZ::TransformInterface::GetWorldZ ( )
inlinevirtual

Gets the entity's Z coordinate in world space.

Returns
The entity's Z coordinate in world space.

◆ IsStaticTransform()

virtual bool AZ::TransformInterface::IsStaticTransform ( )
pure virtual

Static transforms

Returns whether the transform is static. A static transform is unmovable and does not respond to requests that would move it.

Returns
True if the transform is static, false if the transform is movable.

◆ MoveEntity()

virtual void AZ::TransformInterface::MoveEntity ( const AZ::Vector3 offset)
inlinevirtual

Moves the entity within world space.

Parameters
offsetA three-dimensional vector that contains the offset to apply to the entity.

◆ NotifyChildChangedEvent()

virtual void AZ::TransformInterface::NotifyChildChangedEvent ( ChildChangeType  changeType,
EntityId  entityId 
)
pure virtual

Notifies a child change event.

Parameters
changeTypethe type of child event, adding or removing
entityIdthe entityId of the child being added or removed

◆ RotateAroundLocalX()

virtual void AZ::TransformInterface::RotateAroundLocalX ( float  eulerAngleRadian)
inlinevirtual

Rotate around the local x-axis for a radian angle.

Parameters
eulerRadianAngleThe angle to rotate around the local x-axis.

◆ RotateAroundLocalY()

virtual void AZ::TransformInterface::RotateAroundLocalY ( float  eulerAngleRadian)
inlinevirtual

Rotate around the local y-axis for a radian angle.

Parameters
eulerRadianAngleThe angle to rotate around the local y-axis.

◆ RotateAroundLocalZ()

virtual void AZ::TransformInterface::RotateAroundLocalZ ( float  eulerAngleRadian)
inlinevirtual

Rotate around the local z-axis for a radian angle.

Parameters
eulerRadianAngleThe angle to rotate around the local z-axis.

◆ SetIsStaticTransform()

virtual void AZ::TransformInterface::SetIsStaticTransform ( bool  isStatic)
inlinevirtual

Set the transform to isStatic. This is needed to set a layer as static. A static transform is unmovable and does not respond to requests that would move it.

◆ SetLocalRotation()

virtual void AZ::TransformInterface::SetLocalRotation ( const AZ::Vector3 eulerRadianAngles)
inlinevirtual

Set the local rotation matrix using the composition of rotations around the principle axes in the order of z-axis first and y-axis and then x-axis.

Parameters
eulerRadianAnglesA Vector3 denoting radian angles of the rotations around each principle axis.

◆ SetLocalRotationQuaternion()

virtual void AZ::TransformInterface::SetLocalRotationQuaternion ( const AZ::Quaternion quaternion)
inlinevirtual

Set the local rotation matrix using a quaternion.

Parameters
quaternionA quaternion representing the rotation to set.

◆ SetLocalTM()

virtual void AZ::TransformInterface::SetLocalTM ( const Transform tm)
inlinevirtual

Sets the entity's local transform and notifies all listeners.

Parameters
tmA reference to a transform for positioning the entity relative to its parent entity.

◆ SetLocalTranslation()

virtual void AZ::TransformInterface::SetLocalTranslation ( const AZ::Vector3 newPosition)
inlinevirtual

Sets the entity's local space translation, which represents how to move the entity to a new position relative to its parent.

Parameters
newPositionA three-dimensional translation vector.

◆ SetLocalX()

virtual void AZ::TransformInterface::SetLocalX ( float  x)
inlinevirtual

Sets the entity's X coordinate in local space.

Parameters
xA new value for the entity's X coordinate in local space.

◆ SetLocalY()

virtual void AZ::TransformInterface::SetLocalY ( float  y)
inlinevirtual

Sets the entity's Y coordinate in local space.

Parameters
yA new value for the entity's Y coordinate in local space.

◆ SetLocalZ()

virtual void AZ::TransformInterface::SetLocalZ ( float  z)
inlinevirtual

Sets the entity's Z coordinate in local space.

Parameters
zA new value for the entity's Z coordinate in local space.

◆ SetParent()

virtual void AZ::TransformInterface::SetParent ( EntityId  id)
inlinevirtual

Sets the entity's parent entity and notifies all listeners. The entity's local transform is moved into the parent entity's space to preserve the entity's world transform.

Parameters
idThe ID of the entity to set as the parent.

◆ SetParentRelative()

virtual void AZ::TransformInterface::SetParentRelative ( EntityId  id)
inlinevirtual

Sets the entity's parent entity, moves the transform relative to the parent entity, and notifies all listeners. This function uses the world transform as a local transform and moves the transform relative to the parent entity.

Parameters
idThe ID of the entity to set as the parent.

◆ SetWorldRotation()

virtual void AZ::TransformInterface::SetWorldRotation ( const AZ::Vector3 eulerAnglesRadian)
inlinevirtual

Rotation modifiers

Set the world rotation matrix using the composition of rotations around the principle axes in the order of z-axis first and y-axis and then x-axis.

Parameters
eulerRadianAnglesA Vector3 denoting radian angles of the rotations around each principle axis.

◆ SetWorldRotationQuaternion()

virtual void AZ::TransformInterface::SetWorldRotationQuaternion ( const AZ::Quaternion quaternion)
inlinevirtual

Sets the entity's rotation in the world in quaternion notation. The origin of the axes is the entity's position in world space.

Parameters
quaternionA quaternion that represents the rotation to use for the entity.

◆ SetWorldTM()

virtual void AZ::TransformInterface::SetWorldTM ( const Transform tm)
inlinevirtual

Sets the world transform and notifies all listeners.

Parameters
tmA reference to a transform for positioning the entity within the world.

◆ SetWorldTranslation()

virtual void AZ::TransformInterface::SetWorldTranslation ( const AZ::Vector3 newPosition)
inlinevirtual

Translation modifiers

Sets the entity's world space translation, which represents how to move the entity to a new position within the world.

Parameters
newPositionA three-dimensional translation vector.

◆ SetWorldX()

virtual void AZ::TransformInterface::SetWorldX ( float  x)
inlinevirtual

Sets the entity's X coordinate in world space.

Parameters
xA new value for the entity's X coordinate in world space.

◆ SetWorldY()

virtual void AZ::TransformInterface::SetWorldY ( float  y)
inlinevirtual

Sets the entity's Y coordinate in world space.

Parameters
yA new value for the entity's Y coordinate in world space.

◆ SetWorldZ()

virtual void AZ::TransformInterface::SetWorldZ ( float  z)
inlinevirtual

Sets the entity's Z coordinate in world space.

Parameters
zA new value for the entity's Z coordinate in world space.

The documentation for this class was generated from the following file: