aŃ5.0.0f4ž’’’s’8-l'€£ę„hŒĪA,Œ€7€’’’’€¦€²€Õ€ Ž€.€†€Ä€ Ž€.€H€«€’’’’€1€1€’’’’ @Ž€€ Q€j€ H€ź€’’’’ €1€1€’’’’ @Ž€€Q€j€ń€(’’’’€1€1€’’’’€Ž€€€j€’’’’€H€›€’’’’€1€1€’’’’@Ž€€Q€j€y€ € Ž€.€y€< Ž€.€Ž€CH€T’’’’€1€1€’’’’ @Ž€€!Q€j€"H€`’’’’#€1€1€’’’’$@Ž€€%Q€j€&H€l’’’’'€1€1€’’’’(@Ž€€)Q€j€*L€{+PPtrm_FileIDm_PathIDm_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespacem_AssemblyNamem_IsEditorScriptČ0ÅņĆōL.`?^Ł0D7€’’’’€¦€²€Š€¦€¦€¦€#¦€+H€3’’’’€1€1€’’’’@Ž€€ Q€j€ ™€< ¦€H H€Z’’’’ €1€1€’’’’@Ž€€Q€j€Š€g¦€¦€¦€#¦€+v~ € €– €Ÿ €Ø €± €ŗ €Ć €Ģ €Õ €Ž  €ē! €ń" €ū# €$ €% €&Õ€#’’’’'€1€1€’’’’(€Ž€€)H€j€’’’’*€1€1€’’’’+@Ž€€,Q€j€-™€*.Ž€8/AssetMetaDataguiddata[0]data[1]data[2]data[3]pathNametimeCreatedoriginalChangesetoriginalNameoriginalParentHash128originalDigestbytes[0]bytes[1]bytes[2]bytes[3]bytes[4]bytes[5]bytes[6]bytes[7]bytes[8]bytes[9]bytes[10]bytes[11]bytes[12]bytes[13]bytes[14]bytes[15]labelsassetStoreReflicenseType z{ļ@īČć5^(H'7€’’’’€¦€²€ Õ€ Ž€#.€,†€Ä€ Ž€#.€,H€«€’’’’€1€1€’’’’ @Ž€€ Q€j€ Õ€5’’’’ €1€1€’’’’ €Ž€€€j€’’’’€H€›€’’’’€1€1€’’’’@Ž€€Q€j€y€ € Ž€#.€, €I@¾€X @Ž€#.€,H€]’’’’€1€1€’’’’@Ž€€Q€j€H€h’’’’€1€1€’’’’ @Ž€€!Q€j€"H€z’’’’#€1€1€’’’’$@Ž€€%Q€j€&MonoImporterPPtrm_FileIDm_PathIDm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariant„’’ˆ@  ’’ąyÆČ ss’’ļŲāVŒF%®;b’RĘćJ,Assets/LeapMotion/Scripts/Tools/ToolModel.cs ToolModel— /******************************************************************************\ * Copyright (C) Leap Motion, Inc. 2011-2014. * * Leap Motion proprietary. Licensed under Apache 2.0 * * Available at http://www.apache.org/licenses/LICENSE-2.0.html * \******************************************************************************/ using UnityEngine; using System.Collections; using Leap; // Interface for all tools. // NOTE: This file is a work in progress, changes to come. public class ToolModel : MonoBehaviour { public float filtering = 0.5f; protected Tool tool_; protected HandController controller_; protected bool mirror_z_axis_ = false; public Tool GetLeapTool() { return tool_; } public void SetLeapTool(Tool tool) { tool_ = tool; } public void MirrorZAxis(bool mirror = true) { mirror_z_axis_ = mirror; } public HandController GetController() { return controller_; } public void SetController(HandController controller) { controller_ = controller; } public Quaternion GetToolRotation() { Quaternion local_rotation = Quaternion.FromToRotation(Vector3.forward, tool_.Direction.ToUnity(mirror_z_axis_)); return GetController().transform.rotation * local_rotation; } public Vector3 GetToolTipVelocity() { Vector3 local_velocity = tool_.TipVelocity.ToUnityScaled(mirror_z_axis_); Vector3 total_scale = Vector3.Scale(GetController().handMovementScale, GetController().transform.localScale); Vector3 scaled_velocity = Vector3.Scale(total_scale, local_velocity); return GetController().transform.TransformDirection(scaled_velocity); } public Vector3 GetToolTipPosition() { Vector3 local_point = tool_.TipPosition.ToUnityScaled(mirror_z_axis_); Vector3 scaled_point = Vector3.Scale(GetController().handMovementScale, local_point); return GetController().transform.TransformPoint(scaled_point); } public void InitTool() { transform.position = GetToolTipPosition(); transform.rotation = GetToolRotation(); } public void UpdateTool() { Vector3 target_position = GetToolTipPosition(); if (Time.deltaTime != 0) { GetComponent().velocity = (target_position - transform.position) * (1 - filtering) / Time.deltaTime; } // Set angular velocity. Quaternion target_rotation = GetToolRotation(); Quaternion delta_rotation = target_rotation * Quaternion.Inverse(transform.rotation); float angle = 0.0f; Vector3 axis = Vector3.zero; delta_rotation.ToAngleAxis(out angle, out axis); if (angle >= 180) { angle = 360 - angle; axis = -axis; } if (angle != 0) GetComponent().angularVelocity = (1 - filtering) * angle * axis; } } ToolModelAssembly-CSharp.dll