levis
levis

Reputation: 397

Listen for GazeInput down event without selecting anything - Google VR Unity

I'm working with the Google VR Unity SDK and I'm trying to create a VR application where users can switch between multiple ambients(places). I want them to switch to a different ambient just by pushing down the magnetic sensor of the cardboard, pointing anywhere. My problem is that every link (like this one) I've found, works with objects selection. I've tried adding an Event Trigger to my Main Camera and adding a Mesh collider to my building but none of them worked.

So, ¿is it possible to listen for the magnetic sensor pushdown in the full scene without having to select an object?

Upvotes: 1

Views: 322

Answers (2)

levis
levis

Reputation: 397

Turns out it's simpler than I thought.

if(Input.GetButtonDown("Fire1")){
  //some code
}

Thing is googleVR removed magnetic button support since version 0.9.0 and I was using 1.0.3. So if you want to implement a trigger for cardboard's magnetic button you need to use v0.8.5.

Upvotes: 2

You could put up a Canvas that's attached to the camera in World Space, so that it always stays in the line of sight. Add a Button to the canvas at the location where the gaze input cursor is, and you should always hit that when triggering.

Upvotes: 1

Related Questions