ToolModelΒΆ

ToolModel updates a model’s position and orientation based on a tracked tool. Compared to hands, tools are very simple and have no internal articulations. GameObjects used for tools should include any needed rigid bodies and colliders for interation with the Unity world.

unity/../../../images/unity/Unity_Tool.jpg

A flashlight is one of the example tools included with the core asset package.

class ToolModel

Updates a tool model based on tracking data from the Leap Motion service/daemon.

In the Leap Motion API, tools represent long, thin objects, like a pencil, which can be tracked by the Leap Motion sensor. Tools are not associated with hands.

A GameObject representing the tool graphics and with this script attached can be added to a HandController‘s ToolModel slot. The HandController will spawn instances of the game object, updates its position during its lifetime, and finally, destroy the spawned instance when tracking of the tool is lost.

Public Functions

HandController GetController()

The Leap Controller object providing tracking data.

Tool GetLeapTool()

The Leap Tool object.

Quaternion GetToolRotation()

The local rotation of this tool based on the tracked tool, the HandController, and the mirror setting.

Vector3 GetToolTipPosition()

The position of the tip of this tool in the Unity scene.

Vector3 GetToolTipVelocity()

Calculates the tip velocity of this tool model within the scene.

void InitTool()

Initalizes the tool by setting its position and orientation.

void MirrorZAxis(bool mirror = true)

Whether to mirror the tool and motion.

void SetController(HandController controller)

Sets the Leap Controller for this ToolModel.

void SetLeapTool(Tool tool)

Sets the Leap Tool for this ToolModel.

void UpdateTool()

Updates the tool by setting its position, velocity, and orientation.

Public Members

float filtering

Smoothing factor applied to movement.