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 isClientAuthority(): boolean
  • Returns true if this peer has client authority over this scene object.

    If true, the client can modify the object and it will be replicated on the server and other clients. If false, the client should not modify the object as it will not be replicated. If undefined, the object is not replicated or not yet replicated.

    Returns boolean

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

    Returns boolean

  • get isLocallyOwned(): boolean
  • Returns true if this scene object is locally owned.

    If true, the client is the owner of this object. If false, the client is not the owner of this object. If undefined, the object is not replicated or not yet replicated.

    Returns boolean

    NetSessionManager

  • get isOwnerExclusive(): boolean
  • Returns whether this object is exclusively replicated to its owner connection.

    Returns boolean

    setOwnerExclusive

  • 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 netObjectId(): number
  • The network ID of the scene object. This is a unique identifier used for network replication. If the scene object is not replicated, or not yet replicated, this value is 0.

    Returns number

    NetSessionManager

  • 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 transformHash(): number
  • The hash of the transform object. Whenever the transform changes, this value is modified.

    Returns number

  • 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.

  • Checks if this scene object and the provided parent scene object originate from the same template.

    Parameters

    • parent: SceneObject

      The parent scene object to compare against.

    • OptionalisRecursive: boolean

      If true, the method performs a recursive check to verify the template origin.

    Returns boolean

    True if both objects originate from the same template, false otherwise.

  • Determines if the scene object originates from a template, potentially evaluating the entire hierarchy.

    Parameters

    • OptionalisRecursive: boolean

      If true, the method recursively checks the object's children to determine if any of them originate from a template.

    Returns boolean

    True, if the scene object itself or if isRecursive is true, any of its children originate from a template.

  • Marks the scene object as dirty for network replication. This will ensure that the object gets replicated to remote clients during the next network update.

    Returns void

    This method is Host Only and has no effect when called on clients, unless the client has authoritative control over the object.

  • 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 boolean

  • Removes a Component from the scene object by its UUID.

    Parameters

    • uuid: UUID

      The component UUID. If the UUID is not a component of this SceneObject, false is returned.

    Returns boolean

    true if the component was removed.

  • Sets whether this client has authority over this scene object.

    When enabled, the owning client can modify the object and changes will be replicated to the server and other clients.

    Parameters

    • authority: boolean

      True to grant client authority, false to revoke it.

    Returns boolean

    True if successfully set, false otherwise.

    Only available on hosts.

    isClientAuthority

  • 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

  • Sets or unsets the specified SceneObjectLockFlag bit flag on the instance. This adds or removes a reason why the scene object is locked.

    Parameters

    • flag: EnumValue<SceneObjectLockFlag, number>

      The flag to set.

    • isLocked: boolean

      True to set the flag.

    • OptionalisRecursive: boolean

      True to set the flag on all children.

    Returns void

  • Sets the owner connection ID for this scene object.

    This method can only be called on the host. Clients cannot set the owner of a scene object. The scene object must have a network identity (be replicated) to have an owner.

    Parameters

    • connectionId: number

      The connection ID of the new owner.

    Returns boolean

    True if the owner was successfully set, false otherwise.

    • NetSessionManager
    • isLocallyOwned
  • Sets whether this object is exclusively replicated to its owner connection.

    When enabled, this object will only be relevant to its owner connection. Other connections will not receive replication updates for this object.

    Parameters

    • exclusive: boolean

      True to only replicate to owner, false to replicate to all relevant connections.

    Returns boolean

    True if successfully set, false otherwise.

    Only available on hosts.

  • 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