Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
TransformCmp Struct Reference

Component used to give a position, rotation, and scale to an entity. More...

#include <default_components.hpp>

Public Member Functions

coma::Vec3 forward () const
 Retrieves direction the entity is looking at. More...
 
coma::Vec3 up () const
 Retrieves world up vector. More...
 
coma::Vec3 right () const
 Retrieves direction pointing to the right of the entity. More...
 
 TransformCmp (const coma::Vec3 &position, const coma::Vec3 &rotation={0.0f, 180.0f, 0.0f}, const coma::Vec3 &scale={1.0f, 1.0f, 1.0f})
 Creates a TransformCmp. More...
 
coma::Mat4 getMatrix () const
 Calculates the transform matrix using position_, rotation_, and scale_. More...
 

Public Attributes

coma::Vec3 position_ = {0.0f,0.0f,0.0f}
 Position in the world relative to the parent's position.
 
coma::Vec3 rotation_ = {0.0f,0.0f,0.0f}
 Rotation in the world relative to the parent's rotation.
 
coma::Vec3 scale_ = {1.0f,1.0f,1.0f}
 Scale in the world relative to the parent's scale.
 

Detailed Description

Component used to give a position, rotation, and scale to an entity.

Constructor & Destructor Documentation

◆ TransformCmp()

TransformCmp::TransformCmp ( const coma::Vec3 position,
const coma::Vec3 rotation = {0.0f,180.0f,0.0f},
const coma::Vec3 scale = {1.0f,1.0f,1.0f} 
)
inlineexplicit

Creates a TransformCmp.

Parameters
positionposition_
rotationrotation_
scalescale_

Member Function Documentation

◆ forward()

coma::Vec3 TransformCmp::forward ( ) const
inline

Retrieves direction the entity is looking at.

Returns

◆ getMatrix()

coma::Mat4 TransformCmp::getMatrix ( ) const
inline

Calculates the transform matrix using position_, rotation_, and scale_.

Returns
Transform matrix.

◆ right()

coma::Vec3 TransformCmp::right ( ) const
inline

Retrieves direction pointing to the right of the entity.

Returns

◆ up()

coma::Vec3 TransformCmp::up ( ) const
inline

Retrieves world up vector.

Returns