Leap Motion Controller

小设备,大可能。做好准备,用全新方式控制您的 Mac 或 PC。Leap Motion Controller 控制器是一款 USB 设备,能够感知双手在空气中的自然移动 - 精确跟踪手和手指的运动。在进入屏幕以外的数字世界时,玩乐、创作和浏览。


桥接:

using UnityEngine;

using System.Collections;

using Leap;

/// <summary>

/// Attach one of these to one of the objects in your scene to use Leap input.

/// It will take care of calling update on LeapInput and create hand objects

/// to represent the hand data in the scene using LeapUnityHandController.

/// It has a number of public fields so you can easily set the values from

/// the Unity inspector. Hands will

/// </summary>

public class LeapUnityBridge : MonoBehaviour

{

/// <summary>

/// These values, set from the Inspector, set the corresponding fields in the

/// LeapUnityExtension for translating vectors.

/// </summary>

public Vector3 m_LeapScaling = new Vector3(0.02f, 0.02f, 0.02f);

public Vector3 m_LeapOffset = new Vector3(0,0,0);

public bool EnableGesture = false;

public bool EnableTransform = false;

public bool EnableScale = false;

public bool EnableRotate = false;

public bool EnableVirtualKeyBoard = false;

public bool EnableMouseControl = false;

void Awake()

{

Leap.UnityVectorExtension.InputScale = m_LeapScaling;

Leap.UnityVectorExtension.InputOffset = m_LeapOffset;

Leap4Unity.EnableGesture = EnableGesture;

VirtualMouseKeyboardContral.MouseControl.enableMouseControl = EnableMouseControl;

VirtualMouseKeyboardContral.KeyBoardControl.enableKeyBoardControl = EnableVirtualKeyBoard;

}

void Update()

{

Leap.UnityVectorExtension.InputOffset = m_LeapOffset;

Leap4Unity.Update();

LeapScreenManager.ScreenUpdate();

}

};

LEAP MOTION + 虚拟现实

真正沉浸式 VR 的未来从这里开始。VR 开发员装置专门设计用于优化开发环境的稳定性和可靠性,能够简单方便地将您的 Leap Motion Controller 与虚拟现实头盔相连接。立即购买,实现您对未来的憧憬。

手指传递参数:

using UnityEngine;

using System.Collections;

//This relatively simple classis added to fingertip objects by the LeapUnityBridge,

//which allows our LeapSelectionController to be notified when a finger collides with any

//object tagged as 'Touchable'

public class LeapFingerCollisionDispatcher : MonoBehaviour {

const float kHitDistance = 20.0f;

void OnTriggerEnter(Collider other)

{

if( other.tag == "Touchable" )

{

LeapUnitySelectionController.Get().OnTouched(gameObject, other);

}

}

void OnTriggerExit(Collider other)

{

if( other.tag == "Touchable" )

{

LeapUnitySelectionController.Get().OnStoppedTouching(gameObject, other);

}

}

void FixedUpdate()

{

if( gameObject.collider.enabled )

{

Debug.DrawRay(transform.position, transform.forward, Color.green);

RaycastHit hit;

if( Physics.Raycast(transform.position, transform.forward, out hit, 20.0f) )

{

LeapUnitySelectionController.Get().OnRayHit(hit);

}

}

}

}