oculus rift single shot on SecondaryIndexTrigger pull

Greeting Everyone! thanks for stopping by to help me with my issue!

alright so im working on a shooter for the Oculus but when i pull the trigger it fires of all the ammo in my gun very rapidly. since the player is using a revolver this is less than ideal.

i understand that the OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) returns a 0.0f - 1.0f float.

so what im doing is something like this :

 if (isRightHand)
        {
            indexTriggerState = OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger, Controller);
       }
        if (indexTriggerState <= 0.1f)
        {
            shotFiredOnTrigger = false;
        }

then later :

  if(indexTriggerState >= 0.95f && !lastFrameFired)
            if (isRightHand)
            {
         
                    if (ammoCount >= 1)
                    {
                        shootGun();
                    }
                    else {
                        ammoEmpty();
                    }
                    lastFrameFired = true;
    }

basically it checks for the float value of the trigger. if its almost all the way pulled it tells the game to fire a shot, and sets a bool to say "hey i just fired. don’t fire again until the trigger is almost entirely let off.

easy and simple. But te problem is it seems like the float for IndexTriggerState reached .9999 something something on frame then even with the trigger still pulled it drops back down to 0.02 or something really low like that.

im not a great coder but im not awful. this is the first project ive done with oculus and i feel like im beating my head against a wall with this and im sure the answer is right there in front of me i just cant see the trees through the forest.

any help you guys can offer would be greatly appreciated.

Hi, @Saint34x

Instead of OVRInput.Get you can use OVRInput.GetDown with same parameters. These method returns true only once on button down event even if user hold it. In this case there is no need to do any additional checks. For example:

    bool bDown = OVRInput.GetDown(OVRInput.SecondaryIndexTrigger, Controller);
    
    if(bDown)
    {
      Shoot();
    }