Actor
Inherited: None
Description
The Actor probably is the most important class in the Thunder Engine. It represents all objects on the scene like 3D meshes, light sources, effects and many more. You should think about Actor as a key chain for the various Components. You can add and remove any components you like at any time except the Transform component. The Transform component must persist constantly and you shoudn’t remove it.
Public Methods
addComponent (const std::string type) |
|
component (const std::string type) |
|
componentInChild (const std::string type) |
|
std::list<Component *> |
componentsInChild (const std::string type) |
int |
hideFlags () const |
bool |
isEnabled () const |
bool |
isEnabledInHierarchy () const |
bool |
isInHierarchy (Actor * actor) const |
bool |
isInstance () const |
bool |
isStatic () const |
int |
layers () const |
Scene * |
scene () const |
void |
setEnabled (const bool enabled) |
void |
setHideFlags (int flags) |
void |
setLayers (const int layers) |
void |
setParent (Object * parent, int32_t position = -1, bool force = false) |
void |
setStatic (const bool flag) |
void |
setTransform (Transform * transform) |
transform () |
|
World * |
world () const |
Public Enums
enum Actor::HideFlags
Constant |
Value |
Description |
Actor::ENABLE |
(1<<0) |
This Actor can be visible on the screen and can be updated in the game cycle. |
Actor::SELECTABLE |
(1<<1) |
This Actor can be selected in the Editor. |
Static Methods
None
Methods Description
Component * Actor::addComponent (std::string type)
Returns created component with specified type;
Component * Actor::component (std::string type)
Returns the component with type if one is attached to this Actor; otherwise returns nullptr.
Component * Actor::componentInChild (std::string type)
Returns the component with type in the Actor’s children using depth search. A component is returned only if it’s found on a current Actor; otherwise returns nullptr.
std::list<Component *> Actor::componentsInChild (std::string type)
Returns a list of the components with type in the Actor’s children using depth search.
int Actor::hideFlags () const
Returns a set of Actor::HideFlags applied to this Actor.
See also setHideFlags().
bool Actor::isEnabled () const
Returns true in case of Actor is enabled; otherwise returns false. Disabled Actors becomes invisible for the user. By default the property is true.
bool Actor::isEnabledInHierarchy () const
Returns false in case of one of Actors in top hierarchy was disabled; otherwise returns true.
bool Actor::isInHierarchy (Actor * actor) const
Return true if actor is a part of hiearhy.
bool Actor::isInstance () const
Returns true in case the current object is an instance of the serialized prefab structure; otherwise returns false.
bool Actor::isStatic () const
Returns true if this actor will not be moved during the game; otherwise returns false.
int Actor::layers () const
Returns the layers list for the this Actor as a bit mask. The layers used for the various purposes like filtering objects before rendering.
See also setLayers().
Scene * Actor::scene () const
Returns the scene where actor attached to.
void Actor::setEnabled (bool enabled)
Marks this Actor as enabled or disabled. Disabled Actors becomes invisible for the user.
See also isEnabled().
void Actor::setHideFlags (int flags)
Applies a new set of Actor::HideFlags flags to this Actor.
See also hideFlags().
void Actor::setLayers (int layers)
Assigns the list of layers for this Actor as a bitmask.
See also *layers*().
void Actor::setParent (Object * parent, int32_t position = -1, bool force = false)
Reimplements: Object::setParent(Object parent, int32_t *position, bool force).
Makes the actor a child of the parent at given position.
Note: Please ignore the force flag it will be provided by the default.
void Actor::setStatic (bool flag)
Marks current Actor as static or dynamic (by default). This flag can help to optimize rendering.
See also isStatic().
void Actor::setTransform (Transform * transform)
Replaces an existant transform with new one.
See also *transform*().
Transform * Actor::transform ()
Returns the Transform component attached to this Actor.
See also setTransform().
World * Actor::world () const
Returns the world where actor attached to.