Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Separate Core from Example
Browse files Browse the repository at this point in the history
  • Loading branch information
ReiiYuki committed Jun 23, 2017
1 parent fefe28b commit 43e71c9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 44 deletions.
33 changes: 19 additions & 14 deletions Assets/Example/Scripts/GestureHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@
using System.Collections.Generic;
using UnityEngine;
using Intel.RealSense.Hand;
public class GestureHandler : MonoBehaviour {

public GameObject leftCursor, rightCursor;

//Call when inti
void Start()
namespace Example
{
public class GestureHandler : MonoBehaviour
{
GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().AddSubscriber(gameObject);
}

// Call When Detect Gesture
void OnGesture(GestureData gesture)
{
if (GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().GetHandSide(gesture) == BodySideType.BODY_SIDE_LEFT)
public GameObject leftCursor, rightCursor;

//Call when inti
void Start()
{
leftCursor.GetComponent<TextMesh>().text = "L : " + gesture.name;
GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().AddSubscriber(gameObject);
}
else if (GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().GetHandSide(gesture) == BodySideType.BODY_SIDE_RIGHT)

// Call When Detect Gesture
void OnGesture(GestureData gesture)
{
rightCursor.GetComponent<TextMesh>().text = "R : " + gesture.name;
if (GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().GetHandSide(gesture) == BodySideType.BODY_SIDE_LEFT)
{
leftCursor.GetComponent<TextMesh>().text = "L : " + gesture.name;
}
else if (GameObject.Find("DepthCameraManager").GetComponent<GesturalManager>().GetHandSide(gesture) == BodySideType.BODY_SIDE_RIGHT)
{
rightCursor.GetComponent<TextMesh>().text = "R : " + gesture.name;
}
}
}
}
65 changes: 35 additions & 30 deletions Assets/Example/Scripts/HandPositionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,48 @@
using System.Collections.Generic;
using UnityEngine;

public class HandPositionHandler : MonoBehaviour {
namespace Example
{
public class HandPositionHandler : MonoBehaviour
{

public GameObject leftCursor, rightCursor;
public GameObject leftCursor, rightCursor;

void Start()
{
GameObject.Find("DepthCameraManager").GetComponent<HandPositionManager>().AddSubscriber(gameObject);
}
void Start()
{
GameObject.Find("DepthCameraManager").GetComponent<HandPositionManager>().AddSubscriber(gameObject);
}

void OnLeftHandChange(Vector3 handPosition)
{
leftCursor.transform.position = Camera.main.transform.position + new Vector3(handPosition.x * 100, handPosition.y * 100, handPosition.z * 100) + Camera.main.transform.forward;
}
void OnLeftHandChange(Vector3 handPosition)
{
leftCursor.transform.position = Camera.main.transform.position + new Vector3(handPosition.x * 100, handPosition.y * 100, handPosition.z * 100) + Camera.main.transform.forward;
}

void OnRightHandChange(Vector3 handPosition)
{
rightCursor.transform.position = Camera.main.transform.position + new Vector3(handPosition.x * 100, handPosition.y * 100, handPosition.z * 100) + Camera.main.transform.forward;
}
void OnRightHandChange(Vector3 handPosition)
{
rightCursor.transform.position = Camera.main.transform.position + new Vector3(handPosition.x * 100, handPosition.y * 100, handPosition.z * 100) + Camera.main.transform.forward;
}

void OnLeftHandAppear()
{
leftCursor.SetActive(true);
}
void OnLeftHandAppear()
{
leftCursor.SetActive(true);
}

void OnLeftHandDisappear()
{
leftCursor.SetActive(false);
}
void OnLeftHandDisappear()
{
leftCursor.SetActive(false);
}

void OnRightHandAppear()
{
rightCursor.SetActive(true);
}
void OnRightHandAppear()
{
rightCursor.SetActive(true);
}

void OnRightHandDisappear()
{
rightCursor.SetActive(false);
}

void OnRightHandDisappear()
{
rightCursor.SetActive(false);
}

}
}

0 comments on commit 43e71c9

Please sign in to comment.