My Project
Loading...
Searching...
No Matches
Engine::Transform Class Reference

Transform component responsible for storing spatial data of a GameObject. Defines position, rotation, and scale in 3D space. Every GameObject should have exactly one Transform. More...

#include <Transform.hpp>

Inheritance diagram for Engine::Transform:
Engine::Component

Public Member Functions

std::string GetTypeName () const override
 Returns the component type name.
 Transform ()=default
 Default constructor.
 Transform (const Maths::Vec3f &pos, const Maths::Vec3f &rot=Maths::Vec3f(), const Maths::Vec3f &scl=Maths::Vec3f(1.f, 1.f, 1.f))
 Creates a transform with specified position, rotation, and scale.
void Translate (const Maths::Vec3f &delta)
 Moves the object by a given offset.
void SetPosition (const Maths::Vec3f &p)
 Sets the world position of the object.
const Maths::Vec3fGetPosition () const
 Returns the current position of the object.
void Update (float dt) override
 Called every frame to update the transform. Currently unused but kept for future logic.
Public Member Functions inherited from Engine::Component
virtual ~Component ()=default
 Virtual destructor to allow proper cleanup of derived components.
virtual void Start ()
 Called once when the component is first initialized.
virtual void OnDestroy ()
 Called when the component is destroyed or removed from the GameObject.

Public Attributes

Maths::Vec3f position {}
 Position of the object in world space.
Maths::Vec3f rotation {}
 Rotation of the object (usually Euler angles).
Maths::Vec3f scale { 1.f, 1.f, 1.f }
 Scale of the object. Default value is (1,1,1).
Public Attributes inherited from Engine::Component
GameObjectgameObject = nullptr
 Pointer to the GameObject that owns this component.

Additional Inherited Members

Protected Member Functions inherited from Engine::Component
 Component ()=default
 Protected constructor to prevent direct instantiation of the base class.

Detailed Description

Transform component responsible for storing spatial data of a GameObject. Defines position, rotation, and scale in 3D space. Every GameObject should have exactly one Transform.

Constructor & Destructor Documentation

◆ Transform() [1/2]

Engine::Transform::Transform ( )
default

Default constructor.

◆ Transform() [2/2]

Engine::Transform::Transform ( const Maths::Vec3f & pos,
const Maths::Vec3f & rot = Maths::Vec3f(),
const Maths::Vec3f & scl = Maths::Vec3f(1.f, 1.f, 1.f) )
inline

Creates a transform with specified position, rotation, and scale.

Parameters
posInitial position
rotInitial rotation
sclInitial scale

Member Function Documentation

◆ GetPosition()

const Maths::Vec3f & Engine::Transform::GetPosition ( ) const
inline

Returns the current position of the object.

Returns
Reference to position vector

◆ GetTypeName()

std::string Engine::Transform::GetTypeName ( ) const
inlineoverridevirtual

Returns the component type name.

Returns
Component type name

Implements Engine::Component.

◆ SetPosition()

void Engine::Transform::SetPosition ( const Maths::Vec3f & p)
inline

Sets the world position of the object.

Parameters
pNew position

◆ Translate()

void Engine::Transform::Translate ( const Maths::Vec3f & delta)
inline

Moves the object by a given offset.

Parameters
deltaTranslation vector

◆ Update()

void Engine::Transform::Update ( float dt)
inlineoverridevirtual

Called every frame to update the transform. Currently unused but kept for future logic.

Parameters
dtDelta time between frames

Reimplemented from Engine::Component.

Member Data Documentation

◆ position

Maths::Vec3f Engine::Transform::position {}

Position of the object in world space.

◆ rotation

Maths::Vec3f Engine::Transform::rotation {}

Rotation of the object (usually Euler angles).

◆ scale

Maths::Vec3f Engine::Transform::scale { 1.f, 1.f, 1.f }

Scale of the object. Default value is (1,1,1).


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