Class SceneObject

An object in the scene graph of a Scene. It has a spatial position in the Scene as is anchored to the scene through the scene graph hierarchy. To add rendering features and simulation behaviors to a SceneObject, Components are added. This can be done either through a FatComponent or by manually adding Components.

Hierarchy (view full)

Constructors

Properties

flagsInternal: EnumValueTyped<SceneObjectFlag, number>

The default set of internal flags.

Accessors

  • get active(): boolean
  • Determines if the object's components are being updated or not.

    Returns boolean

  • set active(value): void
  • Parameters

    • value: boolean

    Returns void

  • get childCount(): number
  • Gets the number of child scene objects of this object.

    Returns number

  • get editorMetaData(): Settings
  • Get the editor meta data.

    Returns Settings

    The API is only valid in the editor.

  • get friendlyName(): string
  • Default name of the scene object.

    Returns string

  • get isDestroyed(): boolean
  • Determines if the object has been destroyed.

    Returns boolean

  • get isTemplateInstance(): boolean
  • Determines if the scene object has been instanced from a Template resource.

    Returns boolean

  • get mobility(): EnumValue<ObjectMobility, number>
  • Sets the ObjectMobility of a scene object.

    Returns EnumValue<ObjectMobility, number>

    This is used primarily as a performance hint to engine systems. Objects with more restricted mobility will result in higher performance. Some mobility constraints will be enforced by the engine itself, while for others the caller must be sure not to break the promise of the set mobility. By default scene object's mobility is unrestricted.

  • set mobility(value): void
  • Parameters

    Returns void

  • get name(): string
  • Name of the scene object.

    Returns string

  • set name(value): void
  • Parameters

    • value: string

    Returns void

  • get ownerUserUUID(): UUID
  • Determines the owning user of the SceneObject.

    Returns UUID

    If the scene object already has an owner, only the owner will be allowed to change or remove the owning user.

  • set ownerUserUUID(value): void
  • Parameters

    Returns void

  • get parent(): SceneObject
  • Parent in the scene object hierarchy. Null for hierarchy root.

    Returns SceneObject

  • set parent(value): void
  • Parameters

    Returns void

  • get templateOriginObjectUUID(): UUID
  • UUID of the scene object in the linked Template, if any.

    Returns UUID

  • set templateOriginObjectUUID(value): void
  • Parameters

    Returns void

  • get templateResourceUUID(): UUID
  • UUID of the Template resource this object is an instance of, if any.

    Returns UUID

  • get uuid(): UUID
  • Returns a universally unique identifier that persists scene save/load.

    Returns UUID

Methods

  • Constructs a new Component of the specified type and adds it to the internal component list.

    Type Parameters

    Parameters

    Returns T

    Instance of the new component.

  • Creates a deep clone of this scene object, all cloned objects and components will receive new UUIDs.

    Parameters

    • parent: SceneObject

      The parent node for the object, if null, the object will be parented to the root of the scene.

    Returns SceneObject

    The cloned scene object or a null object if the cloning failed.

    If the cloned object is the root of a templated scene object, the cloned object will remain templated. Otherwise, the template link will be broken. In this case, modified properties will remain on the clone.

    This API is intended for runtime clones during gameplay. For editor use, use APIs from the SceneObjectUndoRedo class instead, otherwise the undo state is compromised.

  • Destroys the scene object, removing it from its SceneInstance and stopping all Component updates.

    Parameters

    • Optionalimmediate: boolean

      If true the scene object will be fully destroyed immediately. This means that objects that are still referencing this scene object might fail. Normally destruction is delayed until the end of the frame to give other objects a chance to stop using it.

    Returns void

  • Searches the child objects for an object matching the specified name.

    Parameters

    • name: string

      Name of the object to locate.

    • Optionalrecursive: boolean

      If true all descendants of the scene object will be searched, otherwise only immediate children.

    Returns SceneObject

    First found scene object, or null if none found.

  • Searches the child objects for an object with the specified uuid.

    Parameters

    • uuid: UUID

      UUID of the object to locate.

    • Optionalrecursive: boolean

      If true all descendants of the scene object will be searched, otherwise only immediate children.

    Returns SceneObject

    First found scene object, or null if none found.

  • Searches the child objects for objects matching the specified name.

    Parameters

    • name: string

      Name of the objects to locate.

    • Optionalrecursive: boolean

      If true all descendants of the scene object will be searched, otherwise only immediate children.

    Returns SceneObject[]

    All scene objects matching the specified name.

  • Returns a list of all components attached to this object.

    Returns Component[]

    All components attached to this object.

  • Returns a child scene object.

    Parameters

    • index: number

      Index of the child scene object to retrieve.

    Returns SceneObject

    Instance of the child scene object, or null if index is out of range.

  • Searches for a Component of a specific type. If there are multiple components matching the type, only the first one found is returned.

    Type Parameters

    Parameters

    Returns T

    Component instance if found, null otherwise.

  • Searches for all components of a specific type.

    Type Parameters

    Parameters

    Returns T[]

    All components matching the specified type.

  • Returns a FatComponent of the specified type of the scene object has one assigned.

    Type Parameters

    Parameters

    Returns T

    Fat component of the specified type if one was found, or null otherwise.

  • Finds the index of the specified child. If the child does not exist -1 is returned.

    Parameters

    Returns number

    The index of the child, or -1 if it is not found.

  • Checks has the scene object a FatComponent of the specified type.

    Type Parameters

    • T extends FatComponent

      Type of the fat component to check for.

    Parameters

    Returns boolean

    True if the scene object has the specified fat component.

  • Notifies the parent SceneInstance that the scene object is dirty.

    Returns void

  • Removes a Component from the scene object. If there are multiple components matching the type, only the first one found is removed.

    Type Parameters

    • T extends Component

      Type of the component to remove. Includes any components derived from the type.

    Parameters

    Returns void

  • Sets or unsets the specified SceneObjectFlag bit flag on the instance.

    Parameters

    • flag: EnumValue<SceneObjectFlag, number>

      The flag to set.

    • isEnabled: boolean

      True to set the flag.

    • OptionalapplyToChildren: boolean

      True to set the flag on all children.

    Returns void

  • Returns a string representation of an object.

    Returns string

  • Searches for a Component of a specific type. If the component was found, the callback function is called with the component as an argument. If there are multiple components matching the type, only the first one found is used.

    Type Parameters

    Parameters

    • type: ClassOf<T>

      The Component type to get.

    • callback: ((component: T) => K)

      The function to call for each component.

        • (component): K
        • Parameters

          • component: T

          Returns K

    Returns K

    To iterate multiple components use useComponents instead.

  • Searches for all components of a specific type. The callback function is called once for each component, with the current component as an argument.

    Type Parameters

    Parameters

    • type: ClassOf<T>

      The Component type to get.

    • callback: ((component: T) => void)

      The function to call for each component.

        • (component): void
        • Parameters

          • component: T

          Returns void

    Returns void

    To iterate only a single component, use useComponent instead.

  • Locates a rsx object by its sceneRuntimeID and UUID.

    Parameters

    • sceneRuntimeID: number

      The runtime ID of the SceneInstance of the object.

    • uuid: Const<UUID>

      The UUID of the object to retrieve.

    Returns SceneNode

    The object or null if no object with given sceneRuntimeID and uuid has been registered