comparison Orchestland/Assets/LeapMotion/Scripts/Hands/PolyHand.cs @ 3:0030a1b971fb default tip

merge
author Yuta ANSE <e135745@ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2015 23:23:43 +0900
parents f7675884f2a1
children
comparison
equal deleted inserted replaced
2:fdab88fc2cb9 3:0030a1b971fb
1 /******************************************************************************\
2 * Copyright (C) Leap Motion, Inc. 2011-2014. *
3 * Leap Motion proprietary. Licensed under Apache 2.0 *
4 * Available at http://www.apache.org/licenses/LICENSE-2.0.html *
5 \******************************************************************************/
6
7 using UnityEngine;
8 using System.Collections;
9 using Leap;
10
11 /**
12 * A deforming, very low poly count hand.
13 *
14 * All the graphics for this hand are drawn by the fingers. There is no representation
15 * for the palm or the arm.
16 */
17 public class PolyHand : HandModel {
18
19 /** Initializes the hand and calls the finger initializers. */
20 public override void InitHand() {
21 SetPalmOrientation();
22
23 for (int f = 0; f < fingers.Length; ++f) {
24 if (fingers[f] != null) {
25 fingers[f].fingerType = (Finger.FingerType)f;
26 fingers[f].InitFinger();
27 }
28 }
29 }
30
31 /** Updates the hand and calls the finger update functions. */
32 public override void UpdateHand() {
33 SetPalmOrientation();
34
35 for (int f = 0; f < fingers.Length; ++f) {
36 if (fingers[f] != null) {
37 fingers[f].UpdateFinger();
38 }
39 }
40 }
41
42 /** Sets the palm transform. */
43 protected void SetPalmOrientation() {
44 if (palm != null) {
45 palm.position = GetPalmPosition();
46 palm.rotation = GetPalmRotation();
47 }
48 }
49 }