Exemplo n.º 1
0
    void Update()
    {
        DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand);

        if (detectHand.IsSet())
        {
            if (bSpawnBullet && bGunActive)
            {
                bSpawnBullet = false;

                Vector3 dir = detectHand.GetDirectionToFingers();
                dir.Normalize();
                Vector3 startPos = detectHand.GetFinger(EFinger.eIndex).GetTipPosition();

                GameObject obj = Instantiate(m_Bullet, startPos, m_Bullet.transform.rotation);
                obj.GetComponent <Rigidbody>().velocity = dir * m_Speed;
            }
        }
    }