Interface IGameObject

interface IGameObject {
    activeSelf: boolean;
    guid: undefined | string;
    get transform(): IGameObject;
    get worldForward(): Vector3;
    worldPosition: Vector3;
    worldQuaternion: Quaternion;
    get worldRight(): Vector3;
    worldRotation: Vector3;
    worldScale: Vector3;
    get worldUp(): Vector3;
    addComponent<T>(comp: T | ConstructorConcrete<T>, init?: Partial<NoInternalNeedleEngineState<FilterStartingWith<FilterTypes<T, undefined | null | Function>, "_">>>): T;
    addNewComponent<T>(type: Constructor<T>, init?: Partial<NoInternalNeedleEngineState<FilterStartingWith<FilterTypes<T, undefined | null | Function>, "_">>>): T;
    destroy(): void;
    getComponent<T>(type: Constructor<T>): null | T;
    getComponentInChildren<T>(type: Constructor<T>): null | T;
    getComponentInParent<T>(type: Constructor<T>): null | T;
    getComponents<T>(type: Constructor<T>, arr?: T[]): T[];
    getComponentsInChildren<T>(type: Constructor<T>, arr?: T[]): T[];
    getComponentsInParent<T>(type: Constructor<T>, arr?: T[]): T[];
    getOrAddComponent<T>(typeName: null | Constructor<T>): T;
    removeComponent<T>(comp: T): T;
}

Hierarchy

Implemented by

Properties

activeSelf: boolean

if the object is enabled in the hierarchy (usually equivalent to visible)

guid: undefined | string

the object's unique identifier

Accessors

  • get worldForward(): Vector3
  • Get the world forward vector of the Object3D.
    Added by Needle Engine.

    Returns Vector3

  • get worldPosition(): Vector3
  • Get or set the world position of the Object3D.
    Added by Needle Engine.

    Returns Vector3

  • set worldPosition(val): void
  • Get or set the world position of the Object3D.
    Added by Needle Engine.

    Parameters

    Returns void

  • get worldQuaternion(): Quaternion
  • Get or set the world quaternion of the Object3D.
    Added by Needle Engine.

    Returns Quaternion

  • set worldQuaternion(val): void
  • Get or set the world quaternion of the Object3D.
    Added by Needle Engine.

    Parameters

    Returns void

  • get worldRight(): Vector3
  • Get the world right vector of the Object3D.
    Added by Needle Engine.

    Returns Vector3

  • get worldRotation(): Vector3
  • Get or set the world rotation of the Object3D.
    Added by Needle Engine.

    Returns Vector3

  • set worldRotation(val): void
  • Get or set the world rotation of the Object3D.
    Added by Needle Engine.

    Parameters

    Returns void

  • get worldScale(): Vector3
  • Get or set the world scale of the Object3D.
    Added by Needle Engine.

    Returns Vector3

  • set worldScale(val): void
  • Get or set the world scale of the Object3D.
    Added by Needle Engine.

    Parameters

    Returns void

  • get worldUp(): Vector3
  • Get the world up vector of the Object3D.
    Added by Needle Engine.

    Returns Vector3

Methods

  • Remove a component from this object. Expected a component instance

    Type Parameters

    Parameters

    • comp: T | ConstructorConcrete<T>
    • Optionalinit: Partial<NoInternalNeedleEngineState<FilterStartingWith<FilterTypes<T, undefined | null | Function>, "_">>>

    Returns T

    the removed component (equal to the passed in component)

  • Add a new component to this object. Expects a component type (e.g. addNewComponent(Animator))

    Type Parameters

    Parameters

    • type: Constructor<T>
    • Optionalinit: Partial<NoInternalNeedleEngineState<FilterStartingWith<FilterTypes<T, undefined | null | Function>, "_">>>

    Returns T

  • call to destroy this object including all components that are attached to it. Will destroy all children recursively

    Returns void

  • Tries to find a component of a type on this object.

    Type Parameters

    • T

    Parameters

    • type: Constructor<T>

    Returns null | T

    the first instance of a component on this object that matches the passed in type or null if no component of this type (or a subtype) exists

  • Finds a component of a certain type on this object OR a child object if any exists

    Type Parameters

    • T

    Parameters

    • type: Constructor<T>

    Returns null | T

  • Finds a component of a certain type on this object OR a parent object if any exists

    Type Parameters

    • T

    Parameters

    • type: Constructor<T>

    Returns null | T

  • Type Parameters

    • T

    Parameters

    • type: Constructor<T>
    • Optionalarr: T[]

    Returns T[]

    all components of a certain type on this object

  • Finds all components of a certain type on this object AND all children (recursively)

    Type Parameters

    • T

    Parameters

    • type: Constructor<T>
    • Optionalarr: T[]

    Returns T[]

  • Finds all components of a certain type on this object AND all parents (recursively)

    Type Parameters

    • T

    Parameters

    • type: Constructor<T>
    • Optionalarr: T[]

    Returns T[]

  • Searches for a component type on this object. If no component of the searched type exists yet a new instance will be created and returned

    Type Parameters

    • T

    Parameters

    • typeName: null | Constructor<T>

    Returns T

  • Remove a Needle Engine component from the Object3D.

    Type Parameters

    Parameters

    • comp: T

    Returns T