Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Transform

Add this in your code:

#include <engine/game_elements/transform.h>

Description

Class representing a 3D transformation (position, rotation, scale) of a GameObject.

Public Methods


GetPosition

Get world position.

const Vector3& GetPosition() const

SetPosition

Set world position.

Parameters:

  • position: New world position
void SetPosition(const Vector3& position)

GetLocalPosition

Get local position.

const Vector3& GetLocalPosition() const

SetLocalPosition

Set local position.

Parameters:

  • position: New world position
void SetLocalPosition(const Vector3& position)

GetEulerAngles

Get rotation (in degree).

const Vector3& GetEulerAngles() const

GetLocalEulerAngles

Get local rotation (in degree).

const Vector3& GetLocalEulerAngles() const

GetRotation

Get rotation.

const Quaternion& GetRotation() const

GetLocalRotation

Get local rotation.

const Quaternion& GetLocalRotation() const

SetEulerAngles

Set world rotation in degree.

Parameters:

  • rotation: New world rotation
void SetEulerAngles(const Vector3& rotation)

SetLocalEulerAngles

Set local rotation in degree.

Parameters:

  • rotation: New local rotation
void SetLocalEulerAngles(const Vector3& rotation)

SetRotation

Set world rotation.

Parameters:

  • rotation: New world rotation
void SetRotation(const Quaternion& rotation)

SetLocalRotation

Set local rotation.

Parameters:

  • rotation: New local rotation
void SetLocalRotation(const Quaternion& rotation)

GetScale

Get scale.

const Vector3& GetScale() const

GetLocalScale

Get local scale.

const Vector3& GetLocalScale() const

SetLocalScale

Set local scale.

Parameters:

  • scale: New local scale
void SetLocalScale(const Vector3& scale)

GetForward

Get forward direction.

Vector3 GetForward() const

GetBackward

Get backward direction.

Vector3 GetBackward() const

GetLeft

Get left direction.

Vector3 GetLeft() const

GetRight

Get right direction.

Vector3 GetRight() const

GetUp

Get up direction.

Vector3 GetUp() const

GetDown

Get down direction.

Vector3 GetDown() const

GetTransformationMatrix

Set transformation matrix.

const glm::mat4& GetTransformationMatrix() const

SetTransformationMatrix

Set transformation matrix.

Parameters:

  • matrix: New matrix
void SetTransformationMatrix(const glm::mat4& matrix)

GetGameObject

Get GameObject.

std::shared_ptr<GameObject> GetGameObject() const

GetOnTransformUpdated

Get the event that is called when the transform is updated (new position, or new rotation or new scale).

Event<>& GetOnTransformUpdated()

GetOnTransformScaled

Get the event that is called when the transform is scaled.

Event<>& GetOnTransformScaled()