public override bool Detected() { DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand); EFinger indexFinger = EFinger.eThumb + 1; if (detectHand.IsSet()) { if (detectHand.CheckWithDetails(m_GestureDetail)) { var rot = detectHand.GetRotation(); if (timeBegin == false) { timeElapsed = timeReset; timeBegin = true; } //Debug.DrawRay(detectHand.GetFinger(indexFinger).GetTipPosition(), detectHand.GetFinger(indexFinger).GetFingerDirection() * 3.0f, Color.white); //Debug.DrawRay(DetectionManager.Get().GetHand(m_Hand).GetHandPosition(), detectionHand.GetHandAxis(m_HandAxis) * 1000, Color.red); //Debug.Log(stayTime); if (rot.x > 0.25f && m_CoolDownLeft <= 0.0f && timeElapsed >= 3.5f && timeElapsed <= 8.0f && timeBegin) { m_CoolDownLeft = m_CooldownTime; GameObject projectile = Instantiate(prefab) as GameObject; var spawn = detectHand.GetFinger(indexFinger).GetTipPosition(); projectile.transform.position = spawn; Rigidbody rb = projectile.GetComponent <Rigidbody>(); //var di = detectHand.GetFinger(indexFinger).GetFingerDirection(); //di.y -= 0.6f; // di.z += 0.3f; //di.x += 0.2f; //rb.AddForce(Camera.main.transform.forward * 20f, ForceMode.VelocityChange); rb.velocity = Vector3.forward * 8; timeBegin = false; } return(true); } } return(false); }