gameObjects.gameObject#

class gameObjects.gameObject.GameObject(*args: Any, **kwargs: Any)#

Bases: Context, Transform

Base class for gameObjects

class DirtyFlag_(*values)#

Bases: IntFlag

active_state = 2#
all = 15#
light = 8#
none = 0#
transform = 4#
visible_state = 1#
__init__(context, uuid: UUID = None, name: str = 'GameObject', material: int = -1, translate: list = [0.0, 0.0, 0.0], rotation: list = [0.0, 0.0, 0.0], scale: list = [1.0, 1.0, 1.0], scripts: list[Script] = []) None#

Base class for gameObjects

Parameters:
  • context (EmberEngine) – This is the main context of the application

  • uuid (str) – The uuid of the object, if None a new uuid is assigned

  • name (str) – The name that is stored with the gameObject

  • material (int) – The index in the material buffer as override, -1 is default

  • translate (list) – The position of the object, using getter and setter

  • rotation (list) – The rotation of the object, using getter and setter

  • scale (Vector3) – The scale of the object

  • scripts (list[scripts]) – A list containing Paths to dynamic scripts

property active#

The active state of this gameObject (not including parents) @setter: Changes state and marks itself and children _dirty

Type:

@property

addAttachable(t: type, object)#

Add a attachable object to this gameObject

Parameters:
  • t (type) – The type of the attachable

  • object (Any or None) – The instance of the attachable

Returns:

A reference to the added attachable

Return type:

Any or None

addScript(script: Script)#

Attach a script to a gameObject

Parameters:

script (Script) – Reference to the script

dispatch_script_base_method(method_name: str)#

Dispatch and invoke a base method for each attached script

Base methods are cached on the script instance.
  • onStart

  • onUpdate

  • onEnable

  • onDisable

Parameters:

method_name (str) – The name of method to invoke

getAttachable(attachable: str = '')#

Retrieve a reference to a attachable of this GameObject.

Parameters:

attachable (str) – Name of the engine type (attachable) to retrieve.

Returns:

The requested attachable reference, or None if the name is not recognized.

Return type:

Any or None

getParent(filter_physic_base: bool = False) GameObject#
get_physic()#
hierachyActive() bool#

Get the current hierarchical active state of the GameObject :return: True if GameObject AND its ancestors are active :rtype: bool

hierachyVisible() bool#

Get the current hierarchical active state of the GameObject :return: True if GameObject AND its ancestors are active :rtype: bool

onDisable(_on_stop=False) None#
onDisableScripts()#
onEnable(_on_start=False) None#
onEnableScripts()#
onRender() None#
onRenderColliders() None#
onStart() None#

Implemented by inherited class

onStartScripts()#
onUpdate() None#

Implemented by inherited class

onUpdateScripts()#
removeAttachable(t: type)#
removeScript(script: Script)#

Remove script from a gameObject

Parameters:

script (Script) – Reference to the script

selfActive() bool#

Get the current active sate of only the GameObject

selfVisible() bool#

Get the current visible sate of only the GameObject

setActive(state: bool) None#

Sets active state for this GameObject, then marks itself and children dirty

Parameters:

state (bool) – The new state

setParent(parent: GameObject, update: bool = True) None#

Set relation between child and parent object

Parameters:
  • parent (GameObject) – The new parent of this object

  • update (bool) – Whether to update transform local from new parents world world coordinates

setVisible(state: bool) None#

Sets visible state for this GameObject, then marks itself and children dirty

Parameters:

state (bool) – The new state

property visible#

The active state of this gameObject (not including parents) @setter: Changes state and marks itself and children _dirty

Type:

@property