public void PushTool(System.Type toolType, BaseTool.ToolHand hand, BaseTool.ToolMode mode) { PopTool(hand); BaseTool activeAttachedTool = m_hydraRef.GetHand(hand).AddComponent(toolType) as BaseTool; activeAttachedTool.Init(hand, mode); }
/* * Sets tools for specifically th right controler (currently the only one being used. Will be changed) */ public void SetIndividualToolsRight(BaseTool.ToolHand hand) { //if(m_rightHandController != null) //{ //Hand calibration //---------------- if (Input.GetKeyDown(KeyCode.Space)) { //if(m_rightHandController.GetButton( SixenseButtons.START ) || Input.GetKeyDown(KeyCode.P)){ //GetComponent<SixenseInput>().RebindHands(); FreezeHands(); } if (Input.GetKeyUp(KeyCode.Space)) { //if ( m_rightHandController.GetButtonUp( SixenseButtons.START ) || Input.GetKeyUp(KeyCode.P)){ if (!m_gloveCalibrator.isCalibrated) { m_gloveCalibrator.StartCalibration(); } } /*else if(m_rightHandController.GetButton(SixenseButtons.START) && m_rightHandController.GetButtonUp(SixenseButtons.BUMPER)){ * gameObject.GetComponent<SixenseInput>().RebindHands(); * } */ //} }
/* * Returns left/right hand controllers */ public SixenseInput.Controller GetHandController(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHandController); } return(m_rightHandController); }
/* * Gets the left/right hand gameObject */ public Transform GetHandTip(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHandTip); } return(m_rightHandTip); }
/* * Returns left/right hydrahands controllers */ public HydraHand GetHydraHand(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHandHydra); } return(m_rightHandHydra); }
/* * Returns left/right glove controllers */ public GloveController GetGloveController(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftGlove); } return(m_rightGlove); }
public BaseAttachment GetHandDragging(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHandDragTarget); } return(m_rightHandDragTarget); }
public void SetHandDragging(BaseTool.ToolHand hand, BaseAttachment target) { if (hand == BaseTool.ToolHand.LEFT) { m_leftHandDragTarget = target; } m_rightHandDragTarget = target; }
public Vector3 GetHandVelocity(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHandVelocity); } return(m_rightHandVelocity); }
/* * Gets the left/right hand gameObject */ public GameObject GetHand(BaseTool.ToolHand hand) { if (hand == BaseTool.ToolHand.LEFT) { return(m_leftHand); } return(m_rightHand); }
public void PopTool(BaseTool.ToolHand hand) { BaseTool activeAttachedTool = m_hydraRef.GetHand(hand).GetComponent(typeof(BaseTool)) as BaseTool; if (activeAttachedTool != null) { activeAttachedTool.TransitionOut(); Destroy(activeAttachedTool); //Should probably handle this in the transition } }
/* * Checks distance between hand, performer, and a target object */ public bool IsHandCloserThanObject(Transform t, BaseTool.ToolHand hand) { float a = Vector3.Distance(t.position, m_performer.transform.position); float b = Vector3.Distance(GetHandTip(hand).position, m_performer.transform.position); if (a > b) { return(true); } return(false); }
public static SixenseHands ToolHandToSixenseHand(BaseTool.ToolHand hand) { if (hand == ToolHand.LEFT) { return(SixenseHands.LEFT); } if (hand == ToolHand.RIGHT) { return(SixenseHands.RIGHT); } return(SixenseHands.UNKNOWN); }
public Vector3 GetHandColliderPosition(BaseTool.ToolHand hand) { GameObject handObj; if (hand == BaseTool.ToolHand.LEFT) { handObj = m_leftHand; } else { handObj = m_rightHand; } if (handObj.collider != null) { if (handObj.collider.GetType() == typeof(BoxCollider)) { BoxCollider coll = handObj.collider as BoxCollider; return(coll.bounds.center); } } return(Vector3.zero); }
//Tool creation //------------- public void PushTool(System.Type toolType, BaseTool.ToolHand hand) { PushTool(toolType, hand, BaseTool.ToolMode.PRIMARY); }
/* * Returns the the closest object to the hand in a specific proximity list */ public GameObject HandTarget(BaseTool.ToolHand hand, ProximityType proximityTarget, BaseTool.ToolMode mode) { return(GetClosestObjectInList(GetCollisionList(proximityTarget, BaseTool.ToolHandToSixenseHand(hand)), GetHand(hand), mode)); }
/* * Common tools for each hand */ public void SetCommonTools(BaseTool.ToolHand hand) { GloveController m_glove = GetGloveController(hand); //Physics selector //------------ if (m_glove.GetGestureDown("CLOSED_HAND") || Input.GetKeyDown(KeyCode.LeftControl)) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.GRABBING); } //Physics pull //------------ if (m_glove.GetGestureDown("PINKY") || Input.GetKeyDown(KeyCode.LeftShift)) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.TERTIARY); } // else if(m_glove.GetGestureDown("THREE_SWIPE") || Input.GetKeyDown(KeyCode.LeftShift)){ // ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.TERTIARY); // } //Gesture Selector Primary //-------------------- else if (m_glove.GetGestureDown("INDEX_POINT") || Input.GetKeyDown(KeyCode.W)) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.PRIMARY); } //Gesture selector secondary //-------------------- else if (m_glove.GetGestureDown("INDEX_MIDDLE") || Input.GetKeyDown(KeyCode.E)) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.SECONDARY); } else if (m_glove.GetGestureDown("ROCK_ON") || Input.GetKeyDown(KeyCode.S)) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.TERTIARY); } //Fingerplay gestures if (m_glove.GetGestureDown("PLAY_1")) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.PLAY1); } else if (m_glove.GetGestureDown("PLAY_2")) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.PLAY2); } else if (m_glove.GetGestureDown("PLAY_3")) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.PLAY3); } else if (m_glove.GetGestureDown("PLAY_4")) { ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.PLAY4); } //Return to idle //-------------- if (m_glove.GetGestureDown("IDLE_HAND")) { //ToolController.Instance.PopTool(hand); ToolController.Instance.PushTool(typeof(InstrumentGestureTool), hand, BaseTool.ToolMode.IDLE); m_glove.SetCollider(m_glove.activeGesture); } }
public BaseTool currentTool(BaseTool.ToolHand hand) { return(m_hydraRef.GetHand(hand).GetComponent <BaseTool>()); }
public void SetActiveHand(BaseTool.ToolHand hand) { m_hand = hand; }