Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Text3DItem

The Text3DItem is used to display 3D text in a Scene.

Unlike TextItem, this item displays text with adjustable depth and is limited to 30 characters.

Hierarchy

Implements

Index

Properties

active

active: boolean

Defines this item's active state.

If false, this item

  • Ignores (physics-) collisions
  • Ignores tracing, e.g. from RayCast and Input
  • Does not use physics

animated

animated: boolean

Returns true if this item has animation tracks.

axisY

axisY: Vector3
deprecated

axisZ

axisZ: Vector3
deprecated

center

center: Vector3

Returns the center point of this item.

returns

center of this item in world space.

children

children: ItemCollection

Returns all first-level hierarchy children of this item.

Note: This does not return a complete children Transform hierarchy.

See BaseItem.parent

color

color: Color

Defines color of this item.

To change opacity, use BaseItem.opacity.

id

id: string

The unique id of this item.

If several items share the same name, this item can still be found by its id.

See Scene.getItem

See BaseItem.name

input

input: object

Type declaration

  • onActivate: function
    • onActivate(handler: function): void
    • deprecated

      Use {@link BaseItem.input.onClick} instead.

      Parameters

      • handler: function
          • (): void
          • Returns void

      Returns void

  • onButtonDown: function
    • onButtonDown(handler: function): void
    • Triggers whenever the main input is pressed down inside of this item.

      Calling this function on an existing handler overwrites the handler.

      Parameters

      • handler: function

        function to call on press down. Pass null to remove the handler.

          • (): void
          • Returns void

      Returns void

  • onButtonUp: function
    • onButtonUp(handler: function): void
    • Triggers whenever the main input is released inside of this item.

      Calling this function on an existing handler overwrites the handler.

      Parameters

      • handler: function

        function to call on release. Pass null to remove the handler.

          • (): void
          • Returns void

      Returns void

  • onClick: function
    • onClick(handler: function): void
    • Triggers whenever the main input is pressed and released inside of this item.

      Calling this function on an existing click handler overwrites the handler.

      Parameters

      • handler: function

        function to call after click. Pass null to remove the handler.

          • (): void
          • Returns void

      Returns void

  • onHover: function
    • onHover(handler: function): void
    • Triggers whenever the item is hovered.

      Calling this function on existing hover handler overwrites the handler.

      Parameters

      • handler: function

        method to call on hover event. Uses boolean property to determine start and end of hover event. Pass null to remove the handler.

          • (t: boolean): void
          • Parameters

            • t: boolean

            Returns void

      Returns void

  • setCollisionDrag: function
    • setCollisionDrag(): void
    • setCollisionDrag(callback: function): void
    • Creates a drag interaction on this item to another item, allowing this item to be moved on the surface of other items.

      Returns void

    • Creates a drag interaction on this item to another item, allowing this item to be moved on the surface of other items.

      Parameters

      • callback: function

        function to call when the drag interaction ends

          • (): void
          • Returns void

      Returns void

  • setItemDrag: function
    • setItemDrag(target: BaseItem): void
    • setItemDrag(target: BaseItem, callback: function): void
    • Creates a drag interaction which causes this item to be draggable on the target.

      Parameters

      • target: BaseItem

        item to use as drag surface.

      Returns void

    • Creates a drag interaction which causes this item to be draggable on the target.

      Parameters

      • target: BaseItem

        item to use as drag surface.

      • callback: function

        function to call when the drag interaction ends.

          • (): void
          • Returns void

      Returns void

  • setSurfaceDrag: function
    • setSurfaceDrag(target: BaseItem): void
    • setSurfaceDrag(target: BaseItem, callback: function): void
    • deprecated

      Use {@link BaseItem.input.setItemDrag} to make this item draggable on another.

      Parameters

      Returns void

    • deprecated

      Use {@link BaseItem.input.setItemDrag} to make this item draggable on another.

      Parameters

      • target: BaseItem

        item to drag

      • callback: function

        function to call when the drag interaction ends

          • (): void
          • Returns void

      Returns void

masking

masking: boolean

name

name: string

Name of this item displayed in their name tag and in the item hierarchy.

See Scene.getItem

See BaseItem.id

nameVisible

nameVisible: boolean

Toggles visibility of the item name tag.

See BaseItem.name

opacity

opacity: number

Normalized opacity of this item.

Note: Items with opacity below 0.3 ignore inputs, e.g. from BaseItem.input.

orientationQuat

orientationQuat: Quat
deprecated

parent

parent: BaseItem

Returns the parent of this item.

See BaseItem.add

See BaseItem.removeFromParent

physics

physics: object

Type declaration

  • angularVelocity: Vector3

    Returns world space angularVelocity of this item.

    returns

    angular velocity in world space.

  • angularVelocityLocal: Vector3

    Returns local space angularVelocity of this item.

    returns

    angular velocity in world space.

    See BaseItem.parent

  • enabled: boolean

    Toggles this item to be simulated with physics.

    returns

    physics simulation state.

  • force: Vector3

    Defines directional force that is applied on this item each frame.

    returns

    item force in world space.

  • friction: number

    Defines the friction of this item during movement

    • Value of 0 resembles ice
    • Value of 1 resembles a surface with high friction, e.g. car tyre.
    returns

    item friction.

  • group: object
    • velocityLocal: Vector3

      Returns the world space velocity of the group's center of mass.

      returns

      velocity in world space.

  • mass: number

    Defines the mass of this item. Items with higher mass more easily push away items with lower mass.

    returns

    item mass.

  • position: Vector3

    Returns the world space position of the center of mass for this item.

    returns

    center of mass.

  • restitution: number

    Defines this item's restitution (bounciness).

    • Restitution of 0 does not cause item to bounce
    • Restitution of 1 causes item to bounce at no loss of energy
    returns

    item restitution.

  • softness: number

    Defines the velocity threshold at which this item is allowed to be repulsed by collisions.

    High values make this item feel soft, low values make it feel solid.

    returns

    item softness.

  • static: boolean

    Defines static state of this item. Static items have indefinite mass and can not be moved by physics forces.

    returns

    static state.

  • velocity: Vector3

    Returns the world space velocity of the item's center of mass.

    returns

    velocity in world space.

  • velocityLocal: Vector3

    Returns the local space velocity of the item's center of mass.

    returns

    velocity in local space.

    See BaseItem.parent

  • addToCollisionFilter: function
    • addToCollisionFilter(item: BaseItem): void
    • Adds collision filter to target item to ignore collisions, even when this item shares the same collision layer.

      Parameters

      • item: BaseItem

        item to add to collision filter

      Returns void

  • applyForce: function
    • Applies constant directional force to this item each frame.

      Parameters

      • force: Vector3

        world space force to apply.

      Returns void

  • applyImpulse: function
    • Pushes this item with the defined impulse for this frame.

      Parameters

      • origin: Vector3

        origin of the impulse in world space.

      • impulse: Vector3

        direction & force of the impulse.

      Returns void

  • applyImpulseLocal: function
    • Pushes this item with the defined impulse relative to its forward direction for this frame.

      Parameters

      • localOrigin: Vector3

        origin of the impulse relative to item forward direction.

      • impulse: Vector3

        direction & force of the impulse.

      Returns void

  • onCollisionEnter: function
    • onCollisionEnter(handler: function): void
    • Handles the start of a physics collision between this item and another item.

      To remove the handler, pass null for handler.

      Parameters

      • handler: function

        passes BaseItem which this item collides against.

      Returns void

  • onCollisionExit: function
    • onCollisionExit(handler: function): void
    • Handles the end of a physics collision between this item and another item.

      To remove the handler, pass null for handler.

      Parameters

      • handler: function

        passes item which this item collided against.

      Returns void

  • removeFromCollisionFilter: function
    • removeFromCollisionFilter(item: BaseItem): void
    • Removes collision filter from the target item.

      Parameters

      • item: BaseItem

        item to remove from collision filter

      Returns void

  • restrictMovementAxis: function
    • restrictMovementAxis(axes: object): void
    • Restricts this item's movement on the defined axes.

      Parameters

      • axes: object

        axes to restrict movement on.

        • Optional x?: boolean
        • Optional y?: boolean
        • Optional z?: boolean

      Returns void

  • restrictRotationAxis: function
    • restrictRotationAxis(axes: object): void
    • Restricts this item's rotation to the defined rotation axes

      Parameters

      • axes: object

        axes to restrict movement one.

        • Optional x?: boolean
        • Optional y?: boolean
        • Optional z?: boolean

      Returns void

  • shiftPosition: function
    • shiftPosition(shift: Vector3): void
    • Moves this item by an offset from its current position.

      Parameters

      • shift: Vector3

        offset from current position in world space.

      Returns void

  • shiftPositionLocal: function
    • shiftPositionLocal(offset: Vector3): void
    • Moves this item by an offset relative to its forward direction.

      Parameters

      • offset: Vector3

        offset relative to forward direction.

      Returns void

position

position: Vector3
deprecated

Use transform.position to set item position.

relativeTransform

relativeTransform: Transform

The relative Transform of this item in local space.

The local space is determined by this item's BaseItem.parent.

See BaseItem.transform

scale

scale: number
deprecated

Use scale property of BaseItem.transform instead.

speech

speech: string | number

Defines the text in the speech-bubble of this item.

text

text: string

Defines the displayed text of this Text3DItem.

Note: Character count is limited to 30.

thought

thought: string | number

Defines the text in the thought-bubble of this item.

transform

transform: Transform

The Transform of this item in world space.

See BaseItem.relativeTransform

transition

transition: object

Type declaration

  • moveBy: function
    • Moves this item from its current position by local offset vector.

      Parameters

      • target: Vector3

        relative offset to apply.

      • duration: number

        time in seconds.

      Returns Tweener

      created Tweener.

    • Moves this item from its current position by local offset vector.

      Parameters

      • target: Vector3

        relative offset to apply.

      • duration: number

        time in seconds.

      • callback: function

        function to call when the target is reached.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener.

  • moveLinear: function
    • deprecated

      Use {@link BaseItem.transition.moveTo} to move item to another point.

      Parameters

      Returns Tweener

    • deprecated

      Use {@link BaseItem.transition.moveTo} to move item to another point.

      Parameters

      • target: Vector3
      • time: number
      • callback: function
          • (): void
          • Returns void

      Returns Tweener

  • moveLinearLocal: function
    • deprecated

      Use {@link BaseItem.transition.moveBy} to move item.

      Parameters

      Returns Tweener

    • deprecated

      Use {@link BaseItem.transition.moveBy} to move item.

      Parameters

      • target: Vector3
      • t: number
      • callback: function
          • (): void
          • Returns void

      Returns Tweener

  • moveOnPath: function
    • moveOnPath(options: object): Tweener
    • Moves this item on a PathItem.

      Example `

      //moves an item indefinitely on a PathItem
      const myItem = Scene.getItem("myItem")
      const myPath = Scene.getItem("myPath") as PathItem
      
      myItem.transition.moveOnPath({
          path: myPath,
          speed: 1.5,
          turnWithPath: true,
          repeat: true
      })

      `

      Parameters

      • options: object

        path movement options.

        • Optional callback?: function
            • (): void
            • Returns void

        • Optional endPoint?: number
        • path: PathItem
        • Optional repeat?: boolean
        • Optional reverse?: boolean
        • Optional speed?: number
        • Optional startPoint?: number
        • Optional time?: number
        • Optional turnWithPath?: boolean

          For closed paths

      Returns Tweener

      created Tweener.

  • moveTo: function
    • Moves this item to the target point over duration.

      Parameters

      • target: Vector3

        point in world space.

      • duration: number

        time in seconds.

      Returns Tweener

      created Tweener.

    • Moves this item to the target point over duration.

      Parameters

      • target: Vector3

        point in world space.

      • duration: number

        time in seconds.

      • callback: function

        function to call when the target is reached.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener.

  • rotateLocal: function
    • rotateLocal(axis: Vector3, angleInRadians: number, duration: number): Tweener
    • rotateLocal(axis: Vector3, angleInRadians: number, duration: number, callback: function): Tweener
    • rotateLocal(offset: Vector3, axis: Vector3, angleInRadians: number, duration: number): Tweener
    • rotateLocal(offset: Vector3, axis: Vector3, angleInRadians: number, duration: number, callback: function): Tweener
    • Rotates this item by angleInRadians towards axis direction over duration.

      Parameters

      • axis: Vector3

        vector defining the local rotation axis.

      • angleInRadians: number

        rotation in radians.

      • duration: number

        time in seconds.

      Returns Tweener

      created Tweener

    • Rotates this item by angleInRadians towards axis direction over duration.

      Parameters

      • axis: Vector3

        vector defining the local rotation axis.

      • angleInRadians: number

        rotation in radians.

      • duration: number

        time in seconds.

      • callback: function

        function to call when the Tweener ends.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener

    • Rotates this item by angleInRadians around an offset towards axis direction over duration.

      Parameters

      • offset: Vector3

        offset relative to current position.

      • axis: Vector3

        vector defining the local rotation axis.

      • angleInRadians: number

        rotation in radians.

      • duration: number

        time in seconds.

      Returns Tweener

      created Tweener

    • Rotates this item by angleInRadians around an offset towards axis direction over duration.

      Parameters

      • offset: Vector3

        offset relative to current position.

      • axis: Vector3

        vector defining the local rotation axis.

      • angleInRadians: number

        rotation in radians.

      • duration: number

        time in seconds.

      • callback: function

        function to call when the Tweener ends.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener

  • rotateLocalAroundOrigin: function
    • rotateLocalAroundOrigin(axis: Vector3, angle: number, time: number): Tweener
    • rotateLocalAroundOrigin(axis: Vector3, angle: number, time: number, callback: function): Tweener
    • Rotates this item around its pivot.

      deprecated

      Use rotateLocal in BaseItem.transition instead.

      Parameters

      • axis: Vector3

        rotation direction.

      • angle: number

        angle in radians.

      • time: number

        duration of the tween.

      Returns Tweener

      rotation Tweener

    • Rotates this item around its pivot.

      deprecated

      Use {@link BaseItem.transition.rotateLocal} instead.

      Parameters

      • axis: Vector3

        rotation direction.

      • angle: number

        angle in radians.

      • time: number

        duration of the tween.

      • callback: function

        function to call on finish.

          • (): void
          • Returns void

      Returns Tweener

      rotation Tweener

  • stop: function
    • stop(): void
    • Stops all Tweener on this item.

      See Tweener

      Returns void

visible

visible: boolean

Toggles this item's visibility. If false, items retains its opacity value, but is not displayed.

See BaseItem.opacity

Methods

add

addLocalPosition

  • addLocalPosition(dx: number, dy: number, dz: number): void

addLocalRotation

  • addLocalRotation(originX: number, originY: number, originZ: number, dirX: number, dirY: number, dirZ: number, radians: number): void
  • deprecated

    Use trasnform.rotateLocal() to add local item rotation.

    Parameters

    • originX: number
    • originY: number
    • originZ: number
    • dirX: number
    • dirY: number
    • dirZ: number
    • radians: number

    Returns void

addRotation

  • addRotation(originX: number, originY: number, originZ: number, dirX: number, dirY: number, dirZ: number, radians: number): void
  • deprecated

    Use trasnform.rotate() to add item rotation.

    Parameters

    • originX: number
    • originY: number
    • originZ: number
    • dirX: number
    • dirY: number
    • dirZ: number
    • radians: number

    Returns void

attachToItem

  • attachToItem(slot: string, obj: BaseItem, objSlot: string): void

copy

delete

  • delete(): void
  • Irreversibly removes this item from the Scene.

    Note: This method does not update previously existing item references.

    Returns void

deleteChildren

  • deleteChildren(): void

deleteFromScene

  • deleteFromScene(): void

distanceTo

  • Returns distance between this item and another item.

    deprecated

    Get distance of BaseItem.transform position to another point instead.

    Parameters

    • other: BaseItem

      item to measure distance to.

    Returns number

  • Returns distance between this item and a point in world space.

    deprecated

    Get distance of BaseItem.transform position to another point instead.

    Parameters

    • point: Vector3

      world space point.

    Returns number

distanceToItem

  • distanceToItem(other: BaseItem): number

distanceToPoint

  • distanceToPoint(x: number, y: number, z: number): number
  • distanceToPoint(point: Vector3): number

faceTo

focusOn

getAxisX

getAxisY

getAxisZ

getChild

  • deprecated

    Access child index directly via <a href="baseitem.html#children">BaseItem.children</a>[indexNumber] instead.

    Parameters

    • index: number

    Returns BaseItem

  • deprecated

    Get child via <a href="baseitem.html#children">BaseItem.children</a>.<a href="itemcollection.html#byname">byName["childName"]</a> instead.

    Parameters

    • name: string

    Returns BaseItem

getColor

  • getColor(): Array<number>

getPosition

getProperty

  • getProperty(key: string): string
  • Gets a custom property from this object. Returns null if the property can not be found.

    Parameters

    • key: string

      name of property to search.

    Returns string

getSlot

  • getSlot(name: string): Slot
  • Returns Slot by name.

    Parameters

    • name: string

      name of slot to find.

    Returns Slot

move

  • move(dx: number, dy: number): void
  • move(dx: number, dy: number, dz: number): void
  • move(dx: number, dy: number, dz: number, callback: function): void
  • deprecated

    Use {@link BaseItem.transition.moveBy} instead.

    Parameters

    • dx: number
    • dy: number

    Returns void

  • deprecated

    Use {@link BaseItem.transition.moveBy} instead.

    Parameters

    • dx: number
    • dy: number
    • dz: number

    Returns void

  • deprecated

    Use {@link BaseItem.transition.moveBy} instead.

    Parameters

    • dx: number
    • dy: number
    • dz: number
    • callback: function
        • (): void
        • Returns void

    Returns void

moveLinear

  • moveLinear(x: number, y: number, z: number, t: number): Tweener
  • deprecated

    Use {@link BaseItem.transition.moveLinear} to move item locally.

    Parameters

    • x: number
    • y: number
    • z: number
    • t: number

    Returns Tweener

moveLinearTo

  • moveLinearTo(x: number, y: number, z: number, t: number): Tweener
  • moveLinearTo(x: number, y: number, z: number, t: number, callback: function): Tweener
  • deprecated

    Use {@link BaseItem.transition.moveTo} to move item to another point.

    Parameters

    • x: number
    • y: number
    • z: number
    • t: number

    Returns Tweener

  • deprecated

    Use {@link BaseItem.transition.moveTo} to move item to another point.

    Parameters

    • x: number
    • y: number
    • z: number
    • t: number
    • callback: function
        • (): void
        • Returns void

    Returns Tweener

moveTo

  • moveTo(x: number, y: number): void
  • moveTo(x: number, y: number, z: number): void
  • moveTo(x: number, y: number, z: number, callback: function): void
  • deprecated

    Use {@link BaseItem.transition.moveTo} instead.

    Parameters

    • x: number
    • y: number

    Returns void

  • deprecated

    Use {@link BaseItem.transition.moveTo} instead.

    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

  • deprecated

    Use {@link BaseItem.transition.moveTo} instead.

    Parameters

    • x: number
    • y: number
    • z: number
    • callback: function
        • (): void
        • Returns void

    Returns void

onActivate

  • onActivate(handler: function): void
  • deprecated

    Use {@link BaseItem.input.onClick} instead.

    Parameters

    • handler: function
        • (): void
        • Returns void

    Returns void

onCollisionEnter

  • onCollisionEnter(handler: function): void
  • Handles the start of a collision between this item and another item.

    To remove the handler, pass null for handler.

    Parameters

    • handler: function

      passes BaseItem which this item collides against.

    Returns void

onCollisionExit

  • onCollisionExit(handler: function): void
  • Handles the end of a collision between this item and another item.

    Calling this function on an existing collision handler overwrites the handler.

    Parameters

    • handler: function

      passes item which this item collided against.

    Returns void

onHover

  • onHover(handler: function): void
  • deprecated

    Use {@link BaseItem.input.onHover} instead.

    Parameters

    • handler: function
        • (t: boolean): void
        • Parameters

          • t: boolean

          Returns void

    Returns void

onPropertyChanged

  • onPropertyChanged(id: string, handler: function): void
  • Handles property value changes in this object.

    Parameters

    • id: string

      property to listen to.

    • handler: function

      function that's called when property value is changed.

        • (t: string): void
        • Parameters

          • t: string

          Returns void

    Returns void

removeFromParent

  • removeFromParent(): void

say

  • say(phrase: any): void
  • deprecated

    Use BaseItem.speech property instead.

    Parameters

    • phrase: any

    Returns void

setColor

  • setColor(red: number, green: number, blue: number): void
  • setColor(color: Color): void

setDirection

  • setDirection(dirX: number, dirY: number, dirZ: number): void

setHorizontalDirection

  • setHorizontalDirection(dirX: number, dirY: number): void

setName

  • setName(name: string): void

setOpacity

  • setOpacity(opacity: number): void

setPosition

  • setPosition(x: number, y: number, z: number): void

setPositionAngle

  • setPositionAngle(x: number, y: number, z: number, axisX: number, axisY: number, axisZ: number, angle: number): void

setPositionQuat

  • setPositionQuat(x: number, y: number, z: number, qx: number, qy: number, qz: number, qw: number): void

setProperty

  • setProperty(key: string, value: any): void
  • Sets a custom property to this object.

    Properties are saved as strings.

    Parameters

    • key: string

      property name.

    • value: any

      property value.

    Returns void

setScale

  • setScale(scale: number): void
  • setScale(scale: number, slot: string): void

showInfoPanel

  • showInfoPanel(title: string, image: string, text: string, autoRemove: boolean): Disposable
  • showInfoPanel(title: string, image: string, text: string, autoRemove: boolean, onHide: function): Disposable

showName

  • showName(show: boolean): void

think

  • think(phrase: any): void

Generated using TypeDoc