playMaker

Author Topic: Button-type Event for Slider  (Read 1975 times)

j1knight5

  • Playmaker Newbie
  • *
  • Posts: 8
Button-type Event for Slider
« on: May 18, 2020, 07:09:27 PM »
Hey Folks -

Is there a way to connect a button (or at least Button event functionality - On Press, When Pressed, and On Release) to a Slider's handle?

I'm building out a 2.5D project in which a player is able to aim on the Y-Axis using a slider and I'd like an FSM to be able to detect when the Slider-Handle is being pressed (to fire the weapon).

I've tried removing the Image script on the Slider-Handle and adding a child object (both a Button and Image objects) with event system triggers.  In both cases, I could get the FSM to detect the button / image being pressed but the slider would no longer move.

I dunno if this may require a custom action or a new type of component that detects touch / mouse down / etc. but I'd love it if there was a simply workaround..

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Button-type Event for Slider
« Reply #1 on: May 19, 2020, 03:32:36 AM »
Hi.
I think you can use 'pointer' actions

j1knight5

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Button-type Event for Slider
« Reply #2 on: May 19, 2020, 01:02:00 PM »
Thanks for the insight, DJayDino -  Unfortunately, the pointer options aren't working.  When the event triggers that flags that the Handle object has been touched / clicked / pointed at, the slider functionality ceases.

I forgot to mention that this is a mobile project, so many of the touch options are not working either..  When I attempt to use the Touch Object Event, the entire screen is being detected as a touch (likely since this is on the UI).

Thanks again!

j1knight5

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Button-type Event for Slider
« Reply #3 on: May 19, 2020, 01:35:42 PM »
Ok - so I found a work around which is working...  Unfortunately it involves an aftermarket Asset, making it harder to fix for the folks only slinging Unity+Playmaker.

I'm using Control Freak 2 to help build out the control scheme and I've found that I can create a virtual Joystick for this aiming control function.  I lock the X axis and only move the joystick hat (what I'm using as the Slider-handle) on the Y axis.  The plugin allows me to bind the Y axis to the Fire1 input and also a keyboard key (I'm using F1) when the stick is touched.  From there, I'm able to go into Playmaker and in an FSM, Get Position of the Hat to track the Y movement and I'm able to Get Key Down to flag when the Hat is touched at all (to trigger the firing function).

Hope this helps folks who might be having this same problem!