Class Actor
Defined in File Actor.hpp
Class Documentation
-
class Actor
An object that exists within a World.
Public Functions
-
glm::mat4 GetWorldTransformMatrix() const
Calculate the world-space transformation matrix of the actor.
- Returns:
The world-space transformation matrix
-
inline ActorRef GetParent() const
Access the parent of this actor.
- Returns:
The parent actor, or a null handle if this actor is toplevel
-
bool IsActive() const
Check if the actor is active.
This takes into account both if the actor is enabled and its parent Actor is active
Note
This will return false if the parent Actor is inactive
-
void SetActive(bool state)
Activate or deactivate the actor.
- Parameters:
state – The new activation state
-
void Reparent(ActorRef newParent)
Change the parent of this actor.
- Parameters:
newParent – The new parent of this actor
-
template<typename T>
inline bool HasComponent() const Check if a component is on an actor.
- Returns:
Whether a component of the type is on the actor
-
template<typename T, typename ...Args>
inline void MountComponent(Args&&... args) Create a new component and add it to this actor.
- Parameters:
args – The arguments to the component constructor
- Throws:
ExistingValueException – If a component of this type already exists on the actor
-
void MountComponent(const std::string &factoryID)
Create a new component and add it to this actor.
- Parameters:
factoryID – The ID of the Component factory in with the CodeRegistry to create the component
- Throws:
ExistingValueException – If a component of this type already exists on the actor
NonexistentValueException – If the CodeRegistry does not have a Component actory registered for the provided ID
-
template<typename T>
inline T &GetComponent() const Access a component on the actor.
- Throws:
NonexistentValueException – If a component of this type does not exist on the actor
- Returns:
The component
-
template<typename T>
inline void DeleteComponent() Delete a component from the actor.
- Throws:
NonexistentValueException – If a component of this type does not exist on the actor
-
inline std::unordered_map<std::type_index, Component*> GetAllComponents() const
Get a list of all the components on the actor.
- Returns:
References to all actor components
-
template<typename F>
inline std::unordered_map<std::type_index, Component*> GetComponentsFiltered(F filter) const Get a filtered list of all the components on the actor.
- Parameters:
filter – The filter function to check each component against, returning true for matching components
- Returns:
References to all matching actor components
-
inline std::vector<ActorRef> GetAllChildren() const
Get all the children of the actor.
- Returns:
All child entities
-
glm::mat4 GetWorldTransformMatrix() const