Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConeFrustum

The ConeFrustum is a modifiable item which can be adjusted in height, bottom radius and topRadius.

Hierarchy

Index

Constructors

Properties

active: boolean

Defines this item's active state.

If false, this item

  • Is not visible
  • Ignores (physics-) collisions
  • Ignores tracing, e.g. from RayCast and Input
  • Does not use physics
animated: boolean

Returns true if this item has animation tracks.

bottomRadius: number

Defines the bottomRadius of this ConeFrustum.

This property is multiplied by the item's transform.scale factor.

center: Vector3

Returns the center point of this item.

returns

center of this item in world space.

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

Defines color of this item.

To change opacity, use BaseItem.opacity.

height: number

Defines the height of this ConeFrustum

This property is multiplied by the item's transform.scale factor.

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: { onButtonDown: any; onButtonUp: any; onClick: any; onHover: any; setCollisionDrag: any; setItemDrag: any }

Type declaration

  • onButtonDown:function
    • onButtonDown(handler: (() => void)): 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: (() => void)

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

          • (): void
          • Returns void

      Returns void

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

      Calling this function on an existing handler overwrites the handler.

      Parameters

      • handler: (() => void)

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

          • (): void
          • Returns void

      Returns void

  • onClick:function
    • onClick(handler: (() => void)): 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: (() => void)

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

          • (): void
          • Returns void

      Returns void

  • onHover:function
    • onHover(handler: ((t: boolean) => void)): void
    • Triggers whenever the item is hovered.

      Calling this function on existing hover handler overwrites the handler.

      Parameters

      • handler: ((t: boolean) => void)

        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: (() => void)): 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: (() => void)

        function to call when the drag interaction ends

          • (): void
          • Returns void

      Returns void

  • setItemDrag:function
    • setItemDrag(target: BaseItem): void
    • setItemDrag(target: BaseItem, callback: (() => void)): 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: (() => void)

        function to call when the drag interaction ends.

          • (): void
          • Returns void

      Returns void

masking: boolean
name: string

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

nameVisible: boolean

Toggles visibility of the item name tag.

opacity: number

Normalized opacity of this item.

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

parent: BaseItem

Returns the parent of this item.

physics: { angularVelocity: Vector3; angularVelocityLocal: Vector3; enabled: boolean; force: Vector3; friction: number; group: { velocityLocal: Vector3 }; mass: number; position: Vector3; restitution: number; softness: number; static: boolean; velocity: Vector3; velocityLocal: Vector3; addToCollisionFilter: any; applyForce: any; applyImpulse: any; applyImpulseLocal: any; onCollisionEnter: any; onCollisionExit: any; removeFromCollisionFilter: any; restrictMovementAxis: any; restrictRotationAxis: any; shiftPosition: any; shiftPositionLocal: any }

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.

  • Readonly group: { velocityLocal: Vector3 }
    • 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: ((t: BaseItem) => void)): void
    • Handles the start of a physics collision between this item and another item.

      To remove the handler, pass null for handler.

      Parameters

      • handler: ((t: BaseItem) => void)

        passes BaseItem which this item collides against.

      Returns void

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

      To remove the handler, pass null for handler.

      Parameters

      • handler: ((t: BaseItem) => void)

        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: { x?: boolean; y?: boolean; z?: boolean }): void
    • Restricts this item's movement on the defined axes.

      Parameters

      • axes: { x?: boolean; y?: boolean; z?: boolean }

        axes to restrict movement on.

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

      Returns void

  • restrictRotationAxis:function
    • restrictRotationAxis(axes: { x?: boolean; y?: boolean; z?: boolean }): void
    • Restricts this item's rotation to the defined rotation axes

      Parameters

      • axes: { x?: boolean; y?: boolean; z?: boolean }

        axes to restrict movement one.

        • Optional Readonly x?: boolean
        • Optional Readonly y?: boolean
        • Optional Readonly 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

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

speech: string | number

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

thought: string | number

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

topRadius: number

Defines the topRadius of this ConeFrustum.

This property is multiplied by the item's transform.scale factor.

transform: Transform

The Transform of this item in world space.

transition: { moveBy: any; moveOnPath: any; moveTo: any; rotateLocal: any; stop: any }

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: (() => void)

        function to call when the target is reached.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener.

  • moveOnPath:function
    • moveOnPath(options: { endPoint?: number; path: PathItem; repeat?: boolean; reverse?: boolean; speed?: number; startPoint?: number; time?: number; turnWithPath?: boolean; callback?: any }): 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: { endPoint?: number; path: PathItem; repeat?: boolean; reverse?: boolean; speed?: number; startPoint?: number; time?: number; turnWithPath?: boolean; callback?: any }

        path movement options.

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

          For closed paths

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

      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: (() => void)

        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: (() => void)): Tweener
    • rotateLocal(offset: Vector3, axis: Vector3, angleInRadians: number, duration: number): Tweener
    • rotateLocal(offset: Vector3, axis: Vector3, angleInRadians: number, duration: number, callback: (() => void)): 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: (() => void)

        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: (() => void)

        function to call when the Tweener ends.

          • (): void
          • Returns void

      Returns Tweener

      created Tweener

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

      See Tweener

      Returns void

visible: boolean
deprecated

replaced with BaseItem.active ()}

Methods

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

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

    Returns void

  • deleteChildren(): void
  • 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(name: string): Slot
  • Returns Slot by name.

    Parameters

    • name: string

      name of slot to find.

    Returns Slot

  • onCollisionEnter(handler: ((t: BaseItem) => void)): void
  • Handles the start of a collision between this item and another item.

    To remove the handler, pass null for handler.

    Parameters

    • handler: ((t: BaseItem) => void)

      passes BaseItem which this item collides against.

    Returns void

  • onCollisionExit(handler: ((t: BaseItem) => void)): 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: ((t: BaseItem) => void)

      passes item which this item collided against.

    Returns void

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

    Parameters

    • id: string

      property to listen to.

    • handler: ((t: string) => void)

      function that's called when property value is changed.

        • (t: string): void
        • Parameters

          • t: string

          Returns void

    Returns void

  • removeFromParent(): void
  • 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