Abstract
This creates a new Object3D object.
Abstract
activeIndicates if the GameObject is currently active. Inactive GameObjects will not be rendered or updated. When the activeSelf state changes, components will receive Component.onEnable or Component.onDisable callbacks.
Unique identifier for this GameObject
Allows to control e.g. if an object should be exported
Abstract
worldThe forward direction vector of this GameObject in world space
Abstract
worldThe position of this GameObject in world space
Abstract
worldGet or set the world quaternion of the Object3D.
Added by Needle Engine.
The rotation of this GameObject in world space as a quaternion
Abstract
worldThe right direction vector of this GameObject in world space
Abstract
worldThe rotation of this GameObject in world space in euler angles (degrees)
Abstract
worldAbstract
worldThe up direction vector of this GameObject in world space
Abstract
addCreates a new component on this gameObject or adds an existing component instance
The newly created or added component
Abstract
addAbstract
destroyDestroys this GameObject and all its components. Internally, this is added to the three.js Object3D prototype.
Abstract
getAbstract
getAbstract
getAbstract
getAbstract
getAbstract
getAbstract
getAbstract
removeRemoves a component from this GameObject
Component instance to remove
The removed component
Static
addStatic
addAdds a new component (or moves an existing component) to the provided object
Object to add the component to
If an instance is provided it will be moved to the new object, if a type is provided a new instance will be created
Optional
init: Partial<Optional init object to initialize the component with
Optional
opts: { callAwake: boolean }Optional options for adding the component
The added or moved component
Static
addStatic
destroyStatic
destroyStatic
findFinds an object or component by its unique identifier
Unique identifier to search for
Root object to search in
The found GameObject or Component, or null/undefined if not found
Static
findFinds the first object of the specified component type in the scene
The first matching component if found, otherwise null
Static
findFinds all objects of the specified component type in the scene
Array of matching components
Static
foreachExecutes a callback for all components of the provided type on the provided object and its children
The last return value of the callback
Static
getGets all components on the gameObject
GameObject to get components from
Array of all components
Static
getGets a component on the provided object
GameObject to get the component from
Constructor of the component type
The component if found, otherwise null
Static
getGets a component of the specified type in the gameObject's children hierarchy
GameObject to search in
Constructor of the component type
The first matching component if found, otherwise null
Static
getGets a component of the specified type in the gameObject's parent hierarchy
GameObject to search in
Constructor of the component type
The first matching component if found, otherwise null
Static
getGets all components of the specified type on the provided object
GameObject to get the components from
Constructor of the component type
Optional array to populate with the components
Array of components
Static
getGets all components of the specified type in the gameObject's children hierarchy
GameObject to search in
Constructor of the component type
Optional array to populate with the components
Array of components
Static
getGets all components of the specified type in the gameObject's parent hierarchy
GameObject to search in
Constructor of the component type
Optional array to populate with the components
Array of components
Static
getGets or adds a component of the specified type
GameObject to get or add the component to
Constructor of the component type
The existing or newly added component
Static
instantiateCreates a new instance of the provided object (like cloning it including all components and children)
Object to instantiate
Optional
opts: null | IInstantiateOptionsOptions for the instantiation (e.g. with what parent, position, etc.)
The newly created instance
Creates a new instance of the provided object (like cloning it including all components and children)
Object to instantiate
Optional
opts: null | IInstantiateOptionsOptions for the instantiation (e.g. with what parent, position, etc.)
The newly created instance
Static
instantiateCreates a new instance of the provided object that will be replicated to all connected clients
Object to instantiate
Options for the instantiation
The newly created instance or null if creation failed
Static
invokeInvokes a method on all components that have a method matching the provided name
GameObject to invoke the method on
Name of the method to invoke
Whether to invoke on children as well
Arguments to pass to the method
Static
invokeInvokes a method on all components including children (if a method with that name exists)
GameObject to invoke the method on
Name of the method to invoke
Arguments to pass to the method
Static
isChecks if the GameObject is active in the hierarchy (e.g. if any parent is invisible or not in the scene it will be false)
The GameObject to check
True if the GameObject is active in the hierarchy
Static
isChecks if the GameObject itself is active (same as go.visible)
The GameObject to check
True if the GameObject is active
Static
isChecks if a GameObject has been destroyed
The GameObject to check
True if the GameObject has been destroyed
Static
isChecks if a GameObject is using instanced rendering
The GameObject to check
True if the GameObject is using instanced rendering
Static
iterateIterates through all components on the gameObject
GameObject to iterate components on
Generator yielding each component
Static
markMarks a GameObject to be rendered using instancing
The GameObject to mark
Whether the GameObject should use instanced rendering
Static
moveMoves a component to a new object
GameObject to move the component to
Component to move
The moved component
Static
removeRemoves the object from its parent and deactivates all of its components
Object to remove
Static
removeRemoves a component from its object
Component to remove
The removed component
Static
setSets the active state of a GameObject
The GameObject to modify
Whether the GameObject should be active
Whether to process the start callbacks if being activated
Base class for objects in Needle Engine. Extends Object3D from three.js. GameObjects can have components attached to them, which can be used to add functionality to the object. They manage their components and provide methods to add, remove and get components.
All Object3D types loaded in Needle Engine have methods like addComponent. These methods are available directly on the GameObject instance:
And can be called statically on the GameObject class as well: