playMaker

Author Topic: Zspace VR Action to access the Stylist Buttons  (Read 3731 times)

t4d

  • Junior Playmaker
  • **
  • Posts: 70
Zspace VR Action to access the Stylist Buttons
« on: April 06, 2015, 07:04:46 AM »
Doing some VR work on content for http://zspace.com/ hardware and needed this to Access the Stylist buttons

just change to button 0 to 1 or 2 for  the other buttons


enjoy hope it helps

Code: [Select]
using UnityEngine;

 namespace HutongGames.PlayMaker.Actions
 {
     [ActionCategory("zSpace")]
     [Tooltip("Action generates event if zSpace button 0 pressed")]
     public class zSpaceButton0Input : FsmStateAction
     {
         [RequiredField]
         private ZSCore zsCore;
         public FsmEvent sendEvent;
         public FsmBool storeResult;

         // Code that runs on entering the state.
         public override void OnEnter ()
         {
             zsCore = GameObject.Find ("ZSCore").GetComponent<ZSCore> ();
         }

         // Code that runs every frame.
         public override void OnUpdate ()
         {
             // see if button 0 pressed
             if (zsCore.IsTrackerTargetButtonPressed (ZSCore.TrackerTargetType.Primary, 0)) {
                 Fsm.Event(sendEvent);
                 storeResult.Value = true;
             } else {
                 storeResult.Value = false;
             }
         }
     }
 }

treydavis76

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Zspace VR Action to access the Stylist Buttons
« Reply #1 on: April 09, 2015, 02:32:52 PM »
This may be something I've been looking for.  Where would this script need to go, to allow the Stylus to interact with PlayMaker's functions?

t4d

  • Junior Playmaker
  • **
  • Posts: 70
Re: Zspace VR Action to access the Stylist Buttons
« Reply #2 on: April 12, 2015, 01:18:36 AM »
Drop it in any FSM and it will receive any button pressed on the Zspace Stylist
and send an Event.

currently the Zspace stylist buttons do not appear in Standard Unity input settings panel

treydavis76

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Zspace VR Action to access the Stylist Buttons
« Reply #3 on: May 14, 2015, 11:41:57 AM »
Can you give any specific directions on how to set this up?  I think you may also be the one I replied to a few minutes ago on the zSpace developer site.
Basically, I have very limited scripting experience, so any step by step help that I can get would be GREATLY appreciated!
I need to know exactly how to setup the Playmaker FSM on a button, so that I can click it, and have something happen.  For example, when you click a button on the screen with the stylus, it loads another scene.

t4d

  • Junior Playmaker
  • **
  • Posts: 70
Re: Zspace VR Action to access the Stylist Buttons
« Reply #4 on: May 19, 2015, 02:27:28 AM »
it should be self explanatory just create a C script and drop the text above

name the script file the same as the action in the script "zSpaceButton0Input"

change the 0 to 1 or 2 and save as another script when you need to uses the other buttons

we used it on 2 project to test Zspace and worked fine

the Zspace dudes are not really useful but you should be able to work things out if not, ?  shoot me a message ;)