Reputation: 46
I'm starting to use the SteamVR action-driven Input system Version: 2.3.2 (sdk 1.4.18). I attached a laser pointer script similar to the Steam version to each controller. Now, when I squeeze the trigger, BOTH scripts receive the squeeze action. Well, of course they do. So how can I determine if the squeeze is from MY controller to ensure that I only respond to that?
I already looked at the SteamVR_Input_Sources
parameter. It always reads 'any', so that doesn't help.
Maybe there is an option somewhere to filter which controller messages you wish to receive or a way to determine who invoked the action...?
Upvotes: 2
Views: 511
Reputation: 17554
You can either subscribe to the action like
public void SubscribeToPlayerAction(SteamVR_Action_Boolean action, SteamVR_Action_Boolean.ChangeHandler onAction)
{
action.AddOnChangeListener(onAction, SteamInputSource); //SteamInputSource can be Left Right or Any
}
Or you can poll
public bool CheckForPlayerAction(SteamVR_Action_Boolean action, ButtonAction buttonState = ButtonAction.PressDown)
{
if (buttonState == ButtonAction.PressDown) return action.GetStateDown(SteamInputSource);
if(buttonState == ButtonAction.IsPressed) return action.GetState(SteamInputSource);
return action.GetStateUp(SteamInputSource);
}
Upvotes: 1
Reputation: 182
If you go to windows and open the SteamVR input live view, you can get this menu
This menu will show you which controller is receiving an action
Upvotes: 0