playMaker

Author Topic: Input Broker  (Read 1247 times)

Graham

  • Sr. Member
  • ****
  • Posts: 282
  • I Love Playmaker!
    • View Profile
    • Portfolio
Input Broker
« on: March 16, 2015, 01:26:56 PM »
I read this Unity Answer by Jean Fabre: http://answers.unity3d.com/questions/28473/simulating-key-presses.html

Can this functionality be made into an action for simulating key presses?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Input Broker
« Reply #1 on: March 18, 2015, 02:16:34 AM »
Hi,

 Unfortunatly, that would mean editing the official actions ( for portability), so within Playmaker, I do it differently, because of PlayMaker nature.

 basically, you create your own input broker by having your fsm not rely on the unity  set of input function but yours. and everytime you want to listen to a key press you listen to both the keypress AND a custom keypress flag that you can raise from another fsm.

 so if an fsm wants to do something on  y key press, it should not itself try to catch this keypress, but you should create a fsm that manage inputs and fire a global event "MY KEY PRESSED", that fsm will catch, and so these fsm don't care how ti was triggered, and you can fake keypress very easily then.
 
Does that make sense?

Bye,

 Jean

Graham

  • Sr. Member
  • ****
  • Posts: 282
  • I Love Playmaker!
    • View Profile
    • Portfolio
Re: Input Broker
« Reply #2 on: March 18, 2015, 10:40:16 AM »
Thanks for the info Jean. I was hoping for the actual simulated key press so that it would work with unity's input manager and not require a workaround to get the horizontal easing that is built in, and not need two sets of logic. However I am going another route, and it was not as tedious as I had worried it would be.