Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Actor

An actor represents an object instantiated on the host.

Hierarchy

  • Actor

Implements

Index

Accessors

children

  • get children(): Actor[]

collider

context

id

  • get id(): string

light

lookAt

name

  • get name(): string

parent

parentId

  • get parentId(): string
  • set parentId(value: string): void

rigidBody

subscriptions

  • get subscriptions(): ("transform" | "rigidbody" | "collider")[]

tag

  • get tag(): string
  • set tag(value: string): void

text

transform

Methods

copyDirect

  • copyDirect(sactor: Partial<ActorLike>): this

createAnimation

  • createAnimation(options: object): Promise<void>
  • Create an animation on this actor.

    Parameters

    • options: object

      The animation keyframes, events, and other characteristics.

    Returns Promise<void>

created

  • created(): Promise<void>
  • Provides an awaitable object that resolves once the actor has been created on the host.

    Returns Promise<void>

destroy

  • destroy(): void

enableLight

enableRigidBody

enableText

findChildrenByName

  • findChildrenByName(name: string, recurse: boolean): Actor[]
  • Finds child actors matching name.

    Parameters

    • name: string

      The name of the actors to find.

    • recurse: boolean

      Whether or not to search recursively.

    Returns Actor[]

onCollisionEnter

  • onCollisionEnter(handler: function): this
  • Add an event handler for the collision enter event.

    Parameters

    • handler: function

      The handler to call when the collision event is raised.

    Returns this

onCollisionExit

  • onCollisionExit(handler: function): this
  • Add an event handler for the collision exit event.

    Parameters

    • handler: function

      The handler to call when the collision event is raised.

    Returns this

onTriggerEnter

  • onTriggerEnter(handler: function): this
  • Add an event handler for the trigger enter event.

    Parameters

    • handler: function

      The handler to call when the collision event is raised.

    Returns this

onTriggerExit

  • onTriggerExit(handler: function): this
  • Add an event handler for the trigger exit event.

    Parameters

    • handler: function

      The handler to call when the collision event is raised.

    Returns this

pauseAnimation

  • pauseAnimation(animationName: string): void
  • Pauses the animation.

    Parameters

    • animationName: string

      The name of the animation to pause.

    Returns void

resetAnimation

  • resetAnimation(animationName: string): void
  • Resets the animation to its initial state.

    Parameters

    • animationName: string

      The name of the animation to reset.

    Returns void

resumeAnimation

  • resumeAnimation(animationName: string): void
  • Resumes the animation.

    Parameters

    • animationName: string

      The name of the animation to resume.

    Returns void

setBehavior

  • setBehavior<BehaviorT>(behavior: object): BehaviorT
  • Sets the behavior on this actor.

    Type parameters

    Parameters

    • behavior: object

      The type of behavior to set. Pass null to clear the behavior.

    Returns BehaviorT

startAnimation

  • startAnimation(animationName: string, hasRootMotion?: boolean): void
  • Start playing an animation on this actor.

    Parameters

    • animationName: string

      The name of the animation to start playing.

    • Optional hasRootMotion: boolean

    Returns void

stopAnimation

  • stopAnimation(animationName: string): void
  • Stop playing an animation on this actor and reset the animation's state.

    Parameters

    • animationName: string

      The name of the animation to stop playing.

    Returns void

subscribe

toJSON

unsubscribe

Static CreateEmpty

Static CreateFromGLTF

Static CreateFromLibrary

Static CreateFromPrefab

Static CreatePrimitive