Author Topic: make a simple movement fsm only with pm??  (Read 1571 times)


  • Full Member
  • ***
  • Posts: 110
    • View Profile
make a simple movement fsm only with pm??
« on: February 17, 2012, 11:06:16 AM »
I'm trying to implement a simple movement graph, where upon pressing a key a cube will move x amount in one direction... ok it works but I have to keep pressing the key and release it but I want it to always movew while the key is being pressed... i tried get key (can't get it to work, i even tried get key is true as a bool variable, compare if its true and move while its true) and get key down (the above problem happens), any suggestions?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: make a simple movement fsm only with pm??
« Reply #1 on: February 17, 2012, 12:14:52 PM »
Unity's Input Axis are a very powerful starting point for custom controllers. You have a lot of control over them in the Unity Input Manager (Edit > Project Settings > Input). You can set parameters like sensitivity and gravity to fine tune your controls.

Then in Playmaker you can use Get Axis to get a single axis, or Get Axis Vector to get a vector from 2 input axis (e.g., horizontal and vertical). Get Axis Vector has some additional helpers to specify the movement plane etc.

If you really want to build your own from scratch, I would make 2 FSMs:

- An Input FSM that gets user input and sends events to a Movement FSM.
- A Movement FSM that gets events from the Input FSM and executes them.

I've attached screenshots that show the basic idea. In Set Event Target I dragged the Movement FSM onto the FSM Component field.

Making a controller like this from scratch is a lot more work than using Input Axis...