playMaker

Author Topic: "Smooth Follow Action"  (Read 712 times)

QFGlenn

  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
"Smooth Follow Action"
« on: May 26, 2015, 06:08:41 PM »
I was working on a project in Unity with Playmaker recently, and I encountered a bug. Well not really a bug but it might confuse some people initially.

Smooth Follow Action basically locks you in the current state the action is placed unless you use Global Variables. Even if you have another action in the state that sends a FINISH event it won't trigger. Also any actions below it I think do not work at all. There's no warning for this...

So for example if I wanted something to chase me and I wanted to be able to change the distance they are behind me during runtime I had to create a little workaround I think you'd be able to fix by tweaking the action a little.

I made a child game object, and then set the distance field in the parent to a float Variable. I created an FSM on the child to get the FSM float from the parent, and used ease float action easing the variable I pulled, and then finally I set the FSM variable. I'm not sure how this even happens because there's not any indication from the follow action or the documentation that it is constantly updating these values.

I just wanted to point out a workaround for anyone that also wants to use this handy action. I believe this also works with all the other variables. Hope that helps~!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12348
  • Official Playmaker Support
    • View Profile
Re: "Smooth Follow Action"
« Reply #1 on: May 27, 2015, 04:07:46 AM »
Hi,

 It's by design. Typically a given FSM can only have one state active, and so if you want a complex behavior to be "continuing", you have no other choices than keeping the various states active.

and so, complex  behavior usually are made out of several Fsm, all working for the same final purpose.

in your case. have one fsm that is responsible for the smoothfollow, and just that. Then you can have another Fsm responsible for treating data needed for the smoothfollow and inject values using "set Fsm xxx" in the smoothfollow Fsm.

So no need for Global variables ( can do, but not mandatory), and also, you will encounter this with almost every complex behavior when continuous work is required ( like setting positions, rotations, and manual variables animation)

Bye,

 Jean