playMaker

Author Topic: Set FSM Question  (Read 6350 times)

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Set FSM Question
« on: July 09, 2011, 09:12:45 PM »
Hi,

Here's a link to a video that describes a problem that I'm having with "Set SFM Float".

http://gallery.me.com/henkdawson#100708

Let me know what you think.

Thanks,
Henk

LordShaggy

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 50
Re: Set FSM Question
« Reply #1 on: July 09, 2011, 11:20:56 PM »
ok, if your problem is exactly the same as this guys.


I would recommend first doing a (find game object) and store that reference.  It is a good practice to get into until 1.2 comes out.  I generally like to keep a reference of what I want to talk to.   I would suggest it be prepitory.

-----
Alright, lets see if we can figure this out.   

-I think store magnitude does not work in teh way he thinks it does.

There is an actions called (GET OBJECT SPEED).  Use that instead.

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #2 on: July 10, 2011, 11:44:40 AM »
Hi LordShaggy, I'm not real clear on what you are suggesting but I'll look into the (GET OBJECT SPEED) action. Thanks, Henk

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #3 on: July 11, 2011, 11:40:08 AM »
Hmm... I'm still stuck.

Any ideas would be greatly appreciated.

Thanks,
Henk

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Set FSM Question
« Reply #4 on: July 11, 2011, 05:35:46 PM »
Hi henk,

Cool setup and little guy!

However, you don't need the Get Axis action for point and click movement. GetAxis measures input from keys or a gamepad.

Sounds like you want to gradually increase your character's movement speed while he's moving, starting at zero and accelerating to some max speed.

There's a quite a few ways to do this in Playmaker, but one way that gives you a lot of control is Animate Float. This lets you draw the acceleration curve for your character.

So just replace Get Axis with Animate Float controlling the movement speed.

If you also want to limit the physical movement speed (not just the animation), set the Move Towards Max Speed to the movement speed.

Hope this helps... let me know how it goes.

EDIT: Another tip: Check Debug in the State Inspector to see the current value of action variables, so you can check that they're doing what you expect. E.g., in your example, I'm guessing you'd see movement speed stuck at zero.
« Last Edit: July 11, 2011, 05:40:33 PM by alexchouls »

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #5 on: July 11, 2011, 06:08:48 PM »
Thanks Alex - I'm making progress... Here's a video that shows what's working and what still needs work. Let me know what you think. Thanks, Henk

http://gallery.me.com/henkdawson#100720

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Re: Set FSM Question
« Reply #6 on: July 11, 2011, 11:19:53 PM »
From watching your videos i have 2 questions about what you are trying to achieve...

are you trying to make your little dude run no matter what while he's moving?

or are you trying to make him walk if its a short distance he has to move, and run if its a further distance?

I'd simply use a "get speed" action like lordshaggy suggested, and then use a float compare along with that which will switch between your animation states as required.

this way he'll stay in idle if the speed is 0, start to walk as the speed increases, and then run if he manages to move far enough that he ramps up to whatever speed you specify and then play his run animation

edit: looks like get speed requires a rigid body to be applied to it.  if that's ok for what you need then make sure you turn off use gravity and turn up its mass so it doesnt fall over :)

also, the mouse pick example level usese a itween move to instead of a movetowards, which is something you might want to look into as well.
« Last Edit: July 11, 2011, 11:30:44 PM by justifun »

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #7 on: July 12, 2011, 12:12:23 AM »
Hey JustIfun, yep - I'm trying to make him walk if its a short distance he has to move, and run if its a further distance. I'll work on your suggestions tomorrow and see what I can come up with.

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #8 on: July 12, 2011, 05:10:39 PM »
Okay I'm trying to understand "GET SPEED"

Here's a video that explains my problem:

http://gallery.me.com/henkdawson#100730

Thanks for your help : )

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Re: Set FSM Question
« Reply #9 on: July 12, 2011, 07:52:02 PM »
Make sure the get speed is pointing to the object that is moving,  and double check that there's a rigid body on the object as well. (it doesnt look like there is one from the video)

The issue you are having is that you are getting the speed of the "Stomp1" object, when i suspect its the Cube that you have moving and therefore stomp1 is always 0 cause its parented.

Put the get speed on the cube and you should be golden.

Not sure if this is the way you have it setup, but its probably good practice, to put all of the moving FSM stuff on a node above your animated guy, and put all of the animations seperate on the dude himself.
« Last Edit: July 12, 2011, 08:05:31 PM by justifun »

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: Set FSM Question
« Reply #10 on: July 12, 2011, 08:45:20 PM »
Thanks justifun! this works great! It's simple to do once you know how. Thanks for your help.

Now I'm going to try to figure out iTween. 'looks like a challenge.