View Source

Transform Plugin

Transforms Leap data based off of a rotation matrix or a THREE.js rotation and vectors.

Here we use the riggedHand to visualize the transformations, but it is not required. All data in the frame is altered by the transform plugin.

Parameters can be either static objects or methods which transform on every frame.

In this way, you can then transform individual hands based upon their id.







  // At the simplest:
  Leap.loop()
    .use('transform', {
      // move 20 cm back.
      position: new THREE.Vector3(0,0,-200)
    });

Options

Name Default Description
VR false Sets scale, position, and rotation transforms for HMD mode. These are: units in meters, 8cm forward, and all x, y, and z axis flipped. Also tells tracking to use head-mounted device mode.
position undefined A THREE.Vector3 position offset vector
quaternion undefined A THREE.Quaternion rotation
scale undefined A THREE.Vector scale vector, or a single scalar to be applied to all three axis.
effectiveParent undefined A THREE.Object3d, or anything which responds to `matrixWorld` and `scale`. This matrixWorld is applied to the hand data as well as any transformations specified through the other options. This allows hands to be "attached" to a camera.