Constructor of the ActionController
Override of the MeshEventDispatcher.fire function to use ActionControllerEventName as eventName ActionControllerEvent as event Set's also internal info to mesh.userData
Override of the MeshEventDispatcher.off function to use only ActionControllerEventName as eventName
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 = [];
callback or condition if callback2 is defined
callback if condition callback1 is defined
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 = [];
callback or condition if callback2 is defined
callback if condition callback1 is defined
Function to raycast and fire events of the meshes
Event name to raycast
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);
Controller number from where event was fired. Use 0 for left, 1 for right. For all another with undefined handness use 0 also.
Function to check whether was click with the hardcoded precision
Current event name
Array of ray directions, when button down was fired for all controllers
Current direction
Which controller is in use
Was click or not
Function to get array of objects to raycast.
Selected event name
Array of events from ActionController
Information about click. Check function ActionController.checkClick
Filtered array of Object3D instances
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.
Instance of Object3D to test
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.
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
Array of Object3D instances. Works well with Object3D, Group and Mesh.
Defined raycaster, that is used. Don't forget to set .ray of it.
Sorted array of intersections. Every intersections has property of objectIntersected, if recursion was used.
Generated using TypeDoc
ActionController class provides easy THREE.Mesh events listeners. Use next events for callbacks 'buttonDown', 'move', 'buttonUp', 'over', 'out', 'click'