+2

Oculus Go Input with Bolt

VRmiko 2 years ago updated by Priam Givord 2 months ago 4

Hi folks,

Has anyone tried using Bolt to get button input from Oculus Go or Oculus Gear VR? Just wondering if anyone has an example of a flow machine that they can share to show how it should be done please?

There is a script called OVR Input which is attached to the OVR Camera Rig, and it seems I need to try get the button down value from there in my Update section. Tried a few things and can't seem to get the input out of it. And it's sadly not mapped in Player Input settings when the Oculus Utilities and SDK is imported into Unity.

Any advice or examples you can give would be awesome.

Thanks,

Hendrik

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

What I have figured out so far is to use CustomEvent.Trigger from an Input Manager GameObject with C# script component added in the scene like so:

public GameObject go;

void Update ()

{

if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
        {
            CustomEvent.Trigger(go, "OculusGo_Trigger_Pressed");
        }

}

go is the GameObject that I have dragged and dropped into the script in the Inspector, and OculusGo_Trigger_Pressed is the Bolt Custom Event Unit listening on another GameObject in the scene.

That works really well for all the presses, in case it helps anyone else. I used that for all the button presses on the Oculus Go remote including dpad pressed and dpad swipes. Each OVRInput will fire a custom event and Bolt flow machines can listen to those and do stuff.

I am pretty sure that there is a way to get the OVRInput only with Bolt rather than using a C# script to take the Input and send events to flow machines, but with Bolt I can't find a GetDown method in the OVRInput class at all. Seems for some reason I can't find anything related to getting buttons in OVRInput with Bolt. Could be I'm just overlooking something simple.

Anyhow, I'm happy now as I can get the buttons and interact with my game now :)

Cheers all,

Hendrik

Hi,

That sounds about right, but so many little things I am not getting straight:

- what's Input Manager GameObject? Is that an empty game object on which you put that script?

- what's the "go" object, is that the "OVRControllerPrefab"?

Sorry, confused here, the code looks clear btw, PG

H,l just pasted your code into a new script attached to a game object, here is the complaint: Assets\xxx.cs(5,19): error CS0116: A namespace cannot directly contain members such as fields or methods

OK, so here's most inputs solution: just use a Bolt node onButtonInput and get the default Unity Input Mapping names. Some peeps have identified most of these, for example: the Go's back button is the Fire2 input, just write that name in the onButtonInput event node and you're set. For trackpad Axis, no luck for me so I used https://www.youtube.com/watch?v=SR686aPVT1Q and dragged their touch input script into the Bolt graph and go the touchpad axes in Bolt. I know it should work your way but here is how I got it.