Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: KC1302 on January 07, 2016, 12:54:38 PM

Title: Google Cardboard Trigger event
Post by: KC1302 on January 07, 2016, 12:54:38 PM
http://vrmob.co/wp-content/uploads/2015/06/cardboard_io_2015.jpg

When I pull the trigger of my cardboard. I want to activate a action that allows me to send a event. Except I do not know which type of action I should use.
How can I tell my cardboard trigger to send a event?

Can someone clarify?

Title: Re: Google Cardboard Trigger event
Post by: mdotstrange on January 07, 2016, 06:40:24 PM
By "trigger" do you mean a button on the mobile device?

If so- you want to use the "get button down" action- you will need to figure out the button mappings for your device and use the correct button name in the action.
Title: Re: Google Cardboard Trigger event
Post by: KC1302 on January 07, 2016, 09:35:21 PM
By trigger I mean the button / ring on the cardboard itself.
http://through-the-interface.typepad.com/.a/6a00d83452464869e201bb07e3ae5e970d-pi
I don't know if "get button down" action'' will be detected by my phone.
Has anyone here have experience with this?
Title: Re: Google Cardboard Trigger event
Post by: basuki on February 11, 2016, 04:34:52 PM
Can you use 'any key' trigger?
Title: Re: Google Cardboard Trigger event
Post by: Alex Chouls on February 11, 2016, 04:44:21 PM
I found this about Google Cardboard click:
http://www.andrewnoske.com/wiki/Unity_-_Detecting_Google_Cardboard_Click

With the first example you should be able to replace:
Code: [Select]
Debug.Log("DO SOMETHING HERE");  // PERFORM ACTION.
with:
Code: [Select]
PlayMakerFSM.BroadcastEvent("CardboardClick");
Then use "CardboardClick" events in your FSMs.
Title: Re: Google Cardboard Trigger event
Post by: basuki on February 11, 2016, 09:37:22 PM
I found this about Google Cardboard click:
http://www.andrewnoske.com/wiki/Unity_-_Detecting_Google_Cardboard_Click

With the first example you should be able to replace:
Code: [Select]
Debug.Log("DO SOMETHING HERE");  // PERFORM ACTION.
with:
Code: [Select]
PlayMakerFSM.BroadcastEvent("CardboardClick");
Then use "CardboardClick" events in your FSMs.

Great! Thanks Alex :)
Title: Re: Google Cardboard Trigger event
Post by: Simvirtua on February 15, 2016, 02:26:33 PM
Hi, I'm after buying Playmaker specifically for a Google Cardboard project so being able to detect the magnet button pull is vital. But I also bought Playmaker because I can't code so... can you please expand on the above as my eyes were glazing over slightly :-)

Which script do I require exactly and what exactly do I do with it to be able to detect a pull on the Cardboard magnet button? Thanks in advance.
Title: Re: Google Cardboard Trigger event
Post by: Alex Chouls on February 16, 2016, 03:05:35 AM
Actually doing a little more research, it seems like the Cardboard SDK for Unity makes this a lot simpler.

If you're using the Carboard SDK for Unity the attached file should broadcast an event when the trigger is pressed.

I found this article useful:
http://www.raywenderlich.com/116805/make-vr-game-unity-google-cardboard