AbstractThis creates a new Object3D object.
AbstractactiveIndicates 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
AbstractworldThe forward direction vector of this GameObject in world space
AbstractworldThe position of this GameObject in world space
AbstractworldGet or set the world quaternion of the Object3D.
Added by Needle Engine.
The rotation of this GameObject in world space as a quaternion
AbstractworldThe right direction vector of this GameObject in world space
AbstractworldThe rotation of this GameObject in world space in euler angles (degrees)
AbstractworldAbstractworldThe up direction vector of this GameObject in world space
AbstractaddCreates a new component on this gameObject or adds an existing component instance
The newly created or added component
AbstractaddAbstractdestroyDestroys this GameObject and all its components. Internally, this is added to the three.js Object3D prototype.
AbstractgetAbstractgetAbstractgetAbstractgetAbstractgetAbstractgetAbstractgetAbstractremoveRemoves a component from this GameObject
Component instance to remove
The removed component
StaticaddStaticaddAdds 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
Optionalinit: Partial<Optional init object to initialize the component with
Optionalopts: { callAwake: boolean }Optional options for adding the component
The added or moved component
StaticaddStaticdestroyStaticdestroyStaticfindFinds 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
StaticfindFinds the first object of the specified component type in the scene
The first matching component if found, otherwise null
StaticfindFinds all objects of the specified component type in the scene
Array of matching components
StaticforeachExecutes a callback for all components of the provided type on the provided object and its children
The last return value of the callback
StaticgetGets all components on the gameObject
GameObject to get components from
Array of all components
StaticgetGets a component on the provided object
GameObject to get the component from
Constructor of the component type
The component if found, otherwise null
StaticgetGets 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
StaticgetGets 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
StaticgetGets 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
StaticgetGets 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
StaticgetGets 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
StaticgetGets 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
StaticinstantiateCreates a new instance of the provided object (like cloning it including all components and children)
Object to instantiate
Optionalopts: 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
Optionalopts: null | IInstantiateOptionsOptions for the instantiation (e.g. with what parent, position, etc.)
The newly created instance
StaticinstantiateCreates 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
StaticinvokeInvokes 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
StaticinvokeInvokes 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
StaticisChecks 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
StaticisChecks if the GameObject itself is active (same as go.visible)
The GameObject to check
True if the GameObject is active
StaticisChecks if a GameObject has been destroyed
The GameObject to check
True if the GameObject has been destroyed
StaticisChecks if a GameObject is using instanced rendering
The GameObject to check
True if the GameObject is using instanced rendering
StaticiterateIterates through all components on the gameObject
GameObject to iterate components on
Generator yielding each component
StaticmarkMarks a GameObject to be rendered using instancing
The GameObject to mark
Whether the GameObject should use instanced rendering
StaticmoveMoves a component to a new object
GameObject to move the component to
Component to move
The moved component
StaticremoveRemoves the object from its parent and deactivates all of its components
Object to remove
StaticremoveRemoves a component from its object
Component to remove
The removed component
StaticsetSets 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: