Open 3D Engine AzToolsFramework 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.
AzToolsFramework::Components::TransformComponent Class Reference

#include <TransformComponent.h>

Inherits AzToolsFramework::Components::EditorComponentBase, AZ::TransformBus::Handler, AZ::SliceEntityHierarchyRequestBus::Handler, TransformComponentMessages::Bus::Handler, AZ::EntityBus::Handler, AZ::TransformNotificationBus::MultiHandler, and AZ::TransformHierarchyInformationBus::Handler.

Public Member Functions

void Init () override
 
void Activate () override
 
void Deactivate () override
 
void OnEntityActivated (const AZ::EntityId &parentEntityId) override
 
void OnEntityDeactivated (const AZ::EntityId &parentEntityId) override
 
void BindTransformChangedEventHandler (AZ::TransformChangedEvent::Handler &handler) override
 
void BindParentChangedEventHandler (AZ::ParentChangedEvent::Handler &handler) override
 
void BindChildChangedEventHandler (AZ::ChildChangedEvent::Handler &handler) override
 
void NotifyChildChangedEvent (AZ::ChildChangeType changeType, AZ::EntityId entityId) override
 
const AZ::Transform & GetLocalTM () override
 
void SetLocalTM (const AZ::Transform &tm) override
 
const AZ::Transform & GetWorldTM () override
 
void SetWorldTM (const AZ::Transform &tm) override
 
void GetLocalAndWorld (AZ::Transform &localTM, AZ::Transform &worldTM) override
 
void SetWorldTranslation (const AZ::Vector3 &newPosition) override
 
void SetLocalTranslation (const AZ::Vector3 &newPosition) override
 
AZ::Vector3 GetWorldTranslation () override
 
AZ::Vector3 GetLocalTranslation () override
 
void MoveEntity (const AZ::Vector3 &offset) override
 
void SetWorldX (float newX) override
 
void SetWorldY (float newY) override
 
void SetWorldZ (float newZ) override
 
float GetWorldX () override
 
float GetWorldY () override
 
float GetWorldZ () override
 
void SetLocalX (float x) override
 
void SetLocalY (float y) override
 
void SetLocalZ (float z) override
 
float GetLocalX () override
 
float GetLocalY () override
 
float GetLocalZ () override
 
void SetWorldRotationQuaternion (const AZ::Quaternion &quaternion) override
 
AZ::Vector3 GetWorldRotation () override
 
AZ::Quaternion GetWorldRotationQuaternion () override
 
void SetLocalRotation (const AZ::Vector3 &eulerAnglesRadian) override
 
void SetLocalRotationQuaternion (const AZ::Quaternion &quaternion) override
 
void RotateAroundLocalX (float eulerAngleRadian) override
 
void RotateAroundLocalY (float eulerAngleRadian) override
 
void RotateAroundLocalZ (float eulerAngleRadian) override
 
AZ::Vector3 GetLocalRotation () override
 
AZ::Quaternion GetLocalRotationQuaternion () override
 
AZ::Vector3 GetLocalScale () override
 
void SetLocalUniformScale (float scale) override
 
float GetLocalUniformScale () override
 
float GetWorldUniformScale () override
 
AZ::EntityId GetParentId () override
 
AZ::TransformInterface * GetParent () override
 
void SetParent (AZ::EntityId parentId) override
 
void SetParentRelative (AZ::EntityId parentId) override
 
AZStd::vector< AZ::EntityId > GetChildren () override
 
AZStd::vector< AZ::EntityId > GetAllDescendants () override
 
AZStd::vector< AZ::EntityId > GetEntityAndAllDescendants () override
 
bool IsStaticTransform () override
 
void SetIsStaticTransform (bool isStatic) override
 
void TranslateBy (const AZ::Vector3 &) override
 
void RotateBy (const AZ::Vector3 &) override
 
const EditorTransformGetLocalEditorTransform () override
 
void SetLocalEditorTransform (const EditorTransform &dest) override
 
bool IsTransformLocked () override
 
bool IsRootEntity () const
 
template<typename Callable >
void ForEachChild (Callable callable)
 
void BuildGameEntity (AZ::Entity *gameEntity) override
 
void UpdateCachedWorldTransform ()
 
void ClearCachedWorldTransform ()
 
bool ShowClearButtonHandler ()
 
AZ::EntityId GetSliceEntityParentId () override
 
AZStd::vector< AZ::EntityId > GetSliceEntityChildren () override
 
- Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase
 AZ_RTTI (EditorComponentBase, "{D5346BD4-7F20-444E-B370-327ACD03D4A0}", AZ::Component)
 
 EditorComponentBase ()
 
void SetDirty ()
 
virtual void Init () override
 
virtual void Activate () override
 
virtual void Deactivate () override
 
void OnAfterEntitySet () override final
 
void SetSerializedIdentifier (AZStd::string serializedIdentifier) override final
 
AZStd::string GetSerializedIdentifier () const override final
 
AZ::TransformInterface * GetTransform () const
 
AZ::Transform GetWorldTM () const
 
AZ::Transform GetLocalTM () const
 
bool IsSelected () const
 
virtual void BuildGameEntity (AZ::Entity *)
 
virtual void SetPrimaryAsset (const AZ::Data::AssetId &)
 
virtual void AddContextMenuActions (QMenu *)
 

Static Public Member Functions

static void PasteOverComponent (const TransformComponent *sourceComponent, TransformComponent *destinationComponent)
 
- Static Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase
static void Reflect (AZ::ReflectContext *context)
 

Friends

class JsonTransformComponentSerializer
 
class TransformComponentFactory
 

Detailed Description

Manages transform data as separate vector fields for editing purposes. The TransformComponent is referenced by other components in the same entity, it is not an asset.

Member Function Documentation

◆ Activate()

void AzToolsFramework::Components::TransformComponent::Activate ( )
overridevirtual

Gets the transform component and selection component of the entity that the component belongs to, if the entity has them. Overrides AZ::Component::Activate().

Important: Components derived from EditorComponentBase must call the Activate() function of the base class.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.

◆ BuildGameEntity()

void AzToolsFramework::Components::TransformComponent::BuildGameEntity ( AZ::Entity *  )
overridevirtual

Override this function to create one or more game components to represent your editor component in runtime.

Important: If your entity has a game component, you must implement this function.

This function is called by the slice builder. Any game components that you create should be attached to the game entity that is provided to this function. If you do not need to create a game component, you do not need to override this function. The provided component to the gameEntity is dynamically generated and owned by the gameEntity and should be deallocated appropriately.

Parameters
gameEntityA pointer to the game entity.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.

◆ Deactivate()

void AzToolsFramework::Components::TransformComponent::Deactivate ( )
overridevirtual

Sets the component's pointers to the transform component and selection component to null. Overrides AZ::Component::Deactivate().

Important: Components derived from EditorComponentBase must call the Deactivate() function of the base class.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.

◆ Init()

void AzToolsFramework::Components::TransformComponent::Init ( )
overridevirtual

Initializes the component's resources. Overrides AZ::Component::Init().

Important: Components derived from EditorComponentBase must call the Init() function of the base class.

(Optional) You can override this function to initialize resources that the component needs.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.

◆ IsRootEntity()

bool AzToolsFramework::Components::TransformComponent::IsRootEntity ( ) const
inline
Returns
true if the entity is a root-level entity (has no transform parent).

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