GetStandardInteractionButton() public method

Is the standard interaction button being pressed? In VR, this is a trigger press. In 2D fallback, this is a mouse left-click.
public GetStandardInteractionButton ( ) : bool
return bool
コード例 #1
0
	void OnHandHoverBegin( VRHand hand )
	{
		bool showHint = true;

		// "Catch" the throwable by holding down the interaction button instead of pressing it.
		// Only do this if the throwable is moving faster than the prescribed threshold speed,
		// and if it isn't attached to another hand
		if ( !attached )
		{
			if ( hand.GetStandardInteractionButton() )
			{
				Rigidbody rb = GetComponent<Rigidbody>();
				if ( rb.velocity.magnitude >= catchSpeedThreshold )
				{
					hand.AttachObject( gameObject, attachmentFlags, attachmentPoint );
					showHint = false;
				}
			}
		}

		if ( showHint )
		{
			VRControllerButtonHints.Show( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger );
		}
	}
コード例 #2
0
    void OnHandHoverBegin(VRHand hand)
    {
        bool showHint = true;

        // "Catch" the throwable by holding down the interaction button instead of pressing it.
        // Only do this if the throwable is moving faster than the prescribed threshold speed,
        // and if it isn't attached to another hand
        if (!attached)
        {
            if (hand.GetStandardInteractionButton())
            {
                Rigidbody rb = GetComponent <Rigidbody>();
                if (rb.velocity.magnitude >= catchSpeedThreshold)
                {
                    hand.AttachObject(gameObject, attachmentFlags, attachmentPoint);
                    showHint = false;
                }
            }
        }

        if (showHint)
        {
            VRControllerButtonHints.Show(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
        }
    }
コード例 #3
0
    private void Pulse()
    {
        if (hand && (hand.controller != null) && (hand.GetStandardInteractionButton()))
        {
            ushort duration = ( ushort )Random.Range(minimumPulseDuration, maximumPulseDuration + 1);
            hand.controller.TriggerHapticPulse(duration);

            onPulse.Invoke();
        }
    }
コード例 #4
0
	void OnHandHoverBegin( VRHand hand )
	{
		// "Catch" the throwable by holding down the interaction button instead of pressing it.
		// Only do this if the throwable is moving faster than the prescribed threshold speed,
		// and if it isn't attached to another hand
		if ( !attached )
		{
			if ( hand.GetStandardInteractionButton() )
			{
				Rigidbody rb = GetComponent<Rigidbody>();
				if ( rb.velocity.magnitude >= catchSpeedThreshold )
				{
					hand.AttachObject( gameObject, snapOnAttach, attachmentPoint, detachOthers );
				}
			}
		}
	}
コード例 #5
0
 void OnHandHoverBegin(VRHand hand)
 {
     // "Catch" the throwable by holding down the interaction button instead of pressing it.
     // Only do this if the throwable is moving faster than the prescribed threshold speed,
     // and if it isn't attached to another hand
     if (!attached)
     {
         if (hand.GetStandardInteractionButton())
         {
             Rigidbody rb = GetComponent <Rigidbody>();
             if (rb.velocity.magnitude >= catchSpeedThreshold)
             {
                 hand.AttachObject(gameObject, snapOnAttach, attachmentPoint, detachOthers);
             }
         }
     }
 }
コード例 #6
0
    void HandHoverUpdate( VRHand hand )
    {
        if ( hand.currentAttachedObject )
            return;

        if ( hand.GetStandardInteractionButtonDown() )
        {
            hand.HoverLock( GetComponent<VRInteractable>() );
        }

        if ( hand.GetStandardInteractionButtonUp() )
        {
            hand.HoverUnlock( GetComponent<VRInteractable>() );
        }

        if ( hand.GetStandardInteractionButton() )
        {
            UpdateLinearMapping( hand.transform );
        }
    }
コード例 #7
0
    void HandHoverUpdate(VRHand hand)
    {
        if (hand.currentAttachedObject)
        {
            return;
        }

        if (hand.GetStandardInteractionButtonDown())
        {
            hand.HoverLock(GetComponent <VRInteractable>());
        }

        if (hand.GetStandardInteractionButtonUp())
        {
            hand.HoverUnlock(GetComponent <VRInteractable>());
        }

        if (hand.GetStandardInteractionButton())
        {
            UpdateLinearMapping(hand.transform);
        }
    }
コード例 #8
0
    void HandHoverUpdate(VRHand hand)
    {
        if (hand.GetStandardInteractionButtonDown())
        {
            hand.HoverLock(GetComponent <VRInteractable>());

            initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform);
            sampleCount          = 0;
            mappingChangeRate    = 0.0f;
        }

        if (hand.GetStandardInteractionButtonUp())
        {
            hand.HoverUnlock(GetComponent <VRInteractable>());

            CalculateMappingChangeRate();
        }

        if (hand.GetStandardInteractionButton())
        {
            UpdateLinearMapping(hand.transform);
        }
    }
コード例 #9
0
	void HandHoverUpdate( VRHand hand )
	{
		if ( hand.GetStandardInteractionButtonDown() )
		{
			hand.HoverLock( GetComponent<VRInteractable>() );

			initialMappingOffset = linearMapping.value - CalculateLinearMapping( hand.transform );
			sampleCount = 0;
			mappingChangeRate = 0.0f;
		}

		if ( hand.GetStandardInteractionButtonUp() )
		{
			hand.HoverUnlock( GetComponent<VRInteractable>() );

			CalculateMappingChangeRate();
		}

		if ( hand.GetStandardInteractionButton() )
		{
			UpdateLinearMapping( hand.transform );
		}
	}