Options
All
  • Public
  • Public/Protected
  • All
Menu

ActionController class provides easy THREE.Mesh events listeners. Use next events for callbacks 'buttonDown', 'move', 'buttonUp', 'over', 'out', 'click'

Hierarchy

Index

Constructors

constructor

Methods

fire

off

on

  • Override of the MeshEventDispatcher.on function to use only ActionControllerEventName as eventName Adds next arrays to mesh.userData (if mesh is presented):

    mesh.userData.isButtonDown = [];
    mesh.userData.isOver = [];

    Parameters

    • eventName: ActionControllerEventName
    • Optional mesh: Object3D
    • Optional callback1: Function

      callback or condition if callback2 is defined

    • Optional callback2: Function

      callback if condition callback1 is defined

    Returns void

once

  • Override of the MeshEventDispatcher.on function to use only ActionControllerEventName as eventName Adds next arrays to mesh.userData (if mesh is presented):

    mesh.userData.isButtonDown = [];
    mesh.userData.isOver = [];

    Parameters

    • eventName: ActionControllerEventName
    • Optional mesh: Object3D
    • Optional callback1: Function

      callback or condition if callback2 is defined

    • Optional callback2: Function

      callback if condition callback1 is defined

    Returns void

Protected update

  • Function to raycast and fire events of the meshes

    Parameters

    • eventName: ActionControllerEventName

      Event name to raycast

    • raycaster: Raycaster

      Raycaster with defined ray. You can define raycaster from origin point and quaternion using next code:

      // quaternion: Quaternion and position: Vector3 are defined.
      const direction = new Vector3(0, 0, -1).applyQuaternion(quaternion);
      const raycaster = new Raycaster();
      raycaster.ray.set(position, direction);
    • Default value controllerNumber: number = 0

      Controller number from where event was fired. Use 0 for left, 1 for right. For all another with undefined handness use 0 also.

    Returns void

Static checkClick

  • checkClick(eventName: ActionControllerEventName, buttonDownRayDirections: Array<Vector3>, direction: Vector3, controllerNumber: number): boolean

Static getObjectsToRaycast

Static hasInvisibleParent

  • hasInvisibleParent(object: Object3D): boolean
  • Function, that checks if object has invisible parents in it's parent tree. Also works to check if object isn't attached (isn't child of) to scene.

    Parameters

    • object: Object3D

      Instance of Object3D to test

    Returns boolean

    True in next cases: some of parents are invisible or latest parent isn't Scene. False in next case: all parents are visible and the latest parent is instance of Scene.

Static raycastObjects

  • raycastObjects(objectsToRaycast: Array<Object3D>, raycaster: Raycaster): Array<IntersectionExt>
  • Function that is used by ActionController to raycast objects. It raycasts Meshes with non-recursive flag and Groups and simple Object3Ds with recursive. Result is already sorted by distance

    Parameters

    • objectsToRaycast: Array<Object3D>

      Array of Object3D instances. Works well with Object3D, Group and Mesh.

    • raycaster: Raycaster

      Defined raycaster, that is used. Don't forget to set .ray of it.

    Returns Array<IntersectionExt>

    Sorted array of intersections. Every intersections has property of objectIntersected, if recursion was used.

Legend

  • Namespace
  • Object literal
  • Variable
  • Function
  • Type alias
  • Type alias with type parameter
  • Class
  • Class with type parameter
  • Constructor
  • Method
  • Enumeration
  • Interface
  • Protected method
  • Static method

Generated using TypeDoc