Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Disregarding controller orientation


pouria79
 Share

Recommended Posts

Hello everyone

I'm working on a simple VR shooter game using Wave SDK 3.1.4 and Unity 2019.2.3.

The gameplay is rather simple: the player is in an open world scene with some enemy droids around, and he/she presses the touchpad button to shoot.

The bullets which are rays, come from two guns on both sides of the player, so the player uses their head for aiming and the controller button to shoot, so the controller's orientation and direction doesn't matter (photo attached) .

The problem I'm having is that the controller button doesn't work unless the player is holding it up, facing forward, but I want them to be able to shoot no matter how they're holding the controller. I was wondering if there's any way in Unity to use the controller only for button press and disregard its facing direction/orientation?

I have an InputModuleManager and I've set the Raycast Mode to Fixed and Beam Length to 0.01, so we don't see the beam length at least, but the original issue exists.

I'd appreciate any tips.

Thanks a lot.

screenshot.png

Link to comment
Share on other sites

Hi @pouria79,

In your case since the only thing you need is getting button events, basically you don't need to use InputModuleManager or ControllerLoader. You may work with only Assets/WaveVR/Prefabs/WaveVRButtons. if you want to get events continuously while button pressed and held you may use GetPress(), otherwise GetPressDown() or GetPressUp().

We'd suggest you try the Assets/Samples/Button_Test/ sample in wvr_unity_samples.unitypackage. You may build an apk with this simple sample and test it in Vive Focus. If you find this sample also works unexpectedly, or you think you've done everything right but still couldn't get the result you want, we can help to check your logs or simplified project.

Link to comment
Share on other sites

Thank you so much @Cotta. It worked. ☺️

Only thing is the controller's avatar is still showing up on the headset, along with the beam. Is there a way to make it invisible?

If anyone is trying to do the same with the buttons, here is what I did :

I removed the Module Manager & Controller Input. So now my scene only has a WaveVRButtons prefabs, which has the TouchPad assigned to the dominant buttons of it, and in code I have this:

 void Update()
    {
        bool pressed = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Touchpad);
        if (pressed)
            Shoot();
    }

 

That's it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...