bool IsSwiping(ref EDirection a_swipeDirection) { DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand); Vector3 velocity = detectHand.GetVelocity(); if (velocity.x >= m_VelocityThreshold) //right { a_swipeDirection = EDirection.eRight; return(true); } else if (velocity.x <= -m_VelocityThreshold)//left { a_swipeDirection = EDirection.eLeft; return(true); } else if (velocity.y >= m_VelocityThreshold) //up { a_swipeDirection = EDirection.eUpwards; return(true); } else if (velocity.y <= -m_VelocityThreshold)//down { a_swipeDirection = EDirection.eDownwards; return(true); } else if (velocity.z >= m_VelocityThreshold) //forward { a_swipeDirection = EDirection.eOutwards; return(true); } else if (velocity.z <= -m_VelocityThreshold)//back { a_swipeDirection = EDirection.eInWards; return(true); } return(false); }
public void onGestureEnd() { if (pinching == null) { return; } CardBehavior cb = pinching.GetComponent <CardBehavior>(); cb.pinched = false; DetectionManager.DetectionHand rightHand = DetectionManager.Get().GetHand(EHand.eRightHand); //pinching.GetComponent<Rigidbody>().velocity = rightHand.GetFinger(EFinger.eIndex).GetTipVelocity(); pinching.GetComponent <Rigidbody>().velocity = rightHand.GetVelocity(); Debug.Log(rightHand.GetVelocity().ToString()); //Debug.Log(rightHand.GetFinger(EFinger.eThumb+1).GetTipVelocity().ToString()); pinching.transform.parent = null; pinching = null; //TBD: after release a card, }
public override bool Detected() { bool bFound = false; EDirection currentDirection = GetClosestDirection(ref bFound); if (bFound) { if (currentDirection == m_Direction) { DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand); if (detectHand.IsSet()) { if (detectHand.GetFinger(EFinger.eThumb).IsExtended()) { for (int i = (int)EFinger.eThumb; i <= (int)EFinger.ePinky; i++) { EFinger finger = EFinger.eThumb + i; if (finger != EFinger.eThumb && finger != EFinger.eUnknown) { if (detectHand.GetFinger(finger).IsExtended()) { return(false); } } } return(true); } } } } return(false); }
// bool isOtherObject = false; void Start() { DetectionManager.Get().getCurrentObject += GetSizeObj; }
Vector3 GetPosition() { return(DetectionManager.Get().GetHand(m_Hand).GetHandPosition()); }
public void onGestureStay() { if (DetectionManager.Get().IsHandSet(m_Hand)) { // Detect index finger m_DetectHand = DetectionManager.Get().GetHand(m_Hand); EFinger finger = EFinger.eThumb + 1; // Do raycast here if (DetectionManager.Get().GetHand(m_Hand).IsPinching()) { RaycastHit hit; // Draw ray Debug.DrawRay(m_DetectHand.GetFinger(finger).GetTipPosition(), m_DetectHand.GetFinger(finger).GetFingerDirection() * 0.06f, Color.white); if (pinching != null) { return; } // Draw ray for palm instead //Debug.DrawRay(DetectionManager.Get().GetHand(m_Hand).GetHandPosition(), transform.TransformDirection(Vector3.forward) * 1000, Color.white); if (Physics.Raycast(m_DetectHand.GetFinger(finger).GetTipPosition(), m_DetectHand.GetFinger(finger).GetFingerDirection(), out hit, 0.06f)) // need a length limit on raycast { if (hit.collider.tag == "Card") { Debug.Log("YEET"); //hit.collider.gameObject.transform.parent = parentObject.transform; /* * testObject.transform.parent = parentObject.transform; * vector = parentObject.transform.position; * vector.z += 0.25f; */ GameObject go = hit.collider.gameObject; CardBehavior cb = go.GetComponent <CardBehavior>(); DeckBehavior db = deck.GetComponent <DeckBehavior>(); if (db.cardsInHand.Contains(cb)) // the card pinched is in hand { db.HandToPinch(go); } else // the card pinched is in wild { cb.pinched = true; } go.transform.parent = parentObject.transform; pinching = go; //vector = testObject.transform.position - parentObject.transform.position; //testObject.transform.position = vector; //testObject.transform.position = parentObject.transform.position + translateVector; //hit.collider.gameObject.GetComponent<Rigidbody>().useGravity = false; } } } // End raycast } }
public override bool Detected() { return(DetectionManager.Get().GetHand(m_Hand).IsPinching()); //return false; }
private void Start() { DetectionManager.Get().getCurrentObject += Task1ButtonControl; }
void ClearCurrentObject() { //DetectionManager.Get().GetCurrentGameObject(); DetectionManager.Get().m_ManipulatedObject = null; }
public void SpawnAtLeftHand() { Vector3 pos = DetectionManager.Get().GetHand(EHand.eLeftHand).GetFinger(EFinger.eIndex).GetTipPosition(); Instantiate(m_Object, pos, m_Object.transform.rotation); }
// Use this for initialization void Start() { DetectionManager.Get().getCurrentObject += GetColorObj; //DetectionManager.Get().getCurrentObj += GetColorObj; }
public void UpdateData() { game.SetActive(true); DetectionManager.DetectionHand detectHand_R = DetectionManager.Get().GetHand(EHand.eRightHand); game.transform.position = detectHand_R.GetFinger(EFinger.eIndex).GetTipPosition(); }