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

Component *

addComponent (const TString & type)

Component *

component (const TString & type)

Component *

componentInChild (const TString & type)

std::list<Component *>

components (const TString & type)

std::list<Component *>

componentsInChild (const TString & type) const

int

flags () const

bool

isEnabled () const

bool

isEnabledInHierarchy () const

bool

isInHierarchy (Actor * actor) const

bool

isInstance () const

bool

isStatic () const

Scene *

scene () const

void

setEnabled (const bool enabled)

void

setFlags (int flags)

void

setParent (Object * parent, int32_t position = -1, bool force = false)

void

setStatic (const bool flag)

void

setTransform (Transform * transform)

Transform *

transform ()

World *

world () const

Public Enums

enum Actor::Flags

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.

Actor::Static

(1<<3)

This Actor is not supposed to be moved.

Static Methods

None

Methods Description

Component * Actor::addComponent (TString & type)

Returns created component with specified type;


Component * Actor::component (TString & type)

Returns the component with type if one is attached to this Actor; otherwise returns nullptr.


Component * Actor::componentInChild (TString & 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::components (TString & type)

Returns a list of the components with type attached to this Actor.


std::list<Component *> Actor::componentsInChild (TString & type) const

Returns a list of the components with type in the Actor’s children using depth search.


int Actor::flags () const

Returns a set of Actor::Flags applied to this Actor.

See also setFlags().


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.


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::setFlags (int flags)

Applies a new set of Actor::Flags flags to this Actor.

See also flags().


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. If force is true the parent-relative position, scale and rotation recalculation will be ignored.


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.