playMaker

Author Topic: How to get Float Interpolate to, well, interpolate a float? [SOLVED]  (Read 4982 times)

SpencerPDX

  • Playmaker Newbie
  • *
  • Posts: 22
Hello!

I've got a slider set up to move around an object via a float variable. This works fine, but I'd like to similarly move around the object via set amount of time with the push of a button. Float Interpolate seems like it should do the job, but what I'm seeing is the object pop to the new location a second later (a second being the time over which I'd like to interpolate).

Here's a screen capture video showing my setup, what's working, and what's not:

http://screencast.com/t/txTKYLhPfP9y

You'll need to turn on sound to hear my explanatory babbling.

I feel like I must be close and I'm probably missing something obvious. Coming from the art end of things I could easily be missing some basic principle of programming. But I thought I had my head around Playmaker enough to muddle through this sort of thing.

Any help would be most appreciated!
« Last Edit: May 27, 2015, 06:54:39 PM by SpencerPDX »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #1 on: May 25, 2015, 06:40:44 PM »
I checked out your example- for what you want to do I would use the "ease float" action- it will animate from one float to another and let you choose the time in which it does so and the interpolation type-

So just use the two floats you already have in ease float and it should do the job- it also lets you fire an event when its done which is really handy- hope that helps-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

SpencerPDX

  • Playmaker Newbie
  • *
  • Posts: 22
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #2 on: May 26, 2015, 03:22:35 AM »
Thanks very much for the response! Unfortunately Ease Float was one that I had already tried, with similar results. Here's a quick look at and description of how it plays out:

http://screencast.com/t/GilU1P4Z

Pretty much the same problem as with Float Interpolate - the object just pops over after the set movement time instead of smoothly moving over the course of that time, as I would hope.

But it sounds at least like you're not seeing any other fatal flaws with the setup, is that correct? Because if that's the case I might just scrap this state machine on the assumption it got corrupted at some point and start over. It was carried over from an old Unity4 project and had some other issues along the way, so it seems like some flaws could have worked their way in.

Thanks again!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #3 on: May 26, 2015, 08:43:50 AM »
Yeh I've had those weird pops sometimes too with those actions- you could try one of the itween actions as they don't seem to cause those pops
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

SpencerPDX

  • Playmaker Newbie
  • *
  • Posts: 22
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #4 on: May 26, 2015, 03:21:55 PM »
iTween was going to be my fallback if I couldn't animate the float. But the point of animating the float was to make the movement accessible via both the slider and the button-press - iTween can't do that, can it? It seems as if iTween operates on a vector variable, but I don't see a way to access that via a slider.

I suppose I could do something like a Set Vector 3 XYZ and have the X variable I'm trying to animate in the X slot... That would take some experimenting though; a little more than I can get my head around in the abstract just yet. :)

If there's a way to use iTween to animate the float, that would be great.

Or even better, if I could just Ease Float or Float Interpolate to work the way I expect.

Thanks again!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #5 on: May 27, 2015, 02:10:17 AM »
Hi,

 I think it's simply because you forgot to actual set the position of the line. You do that in the first state, but you don't in the state where you animate the float.

Let me know if you still have issues.

 Bye,

 Jean

SpencerPDX

  • Playmaker Newbie
  • *
  • Posts: 22
Re: How to get Float Interpolate to, well, interpolate a float?
« Reply #6 on: May 27, 2015, 01:21:21 PM »
Hi Jean,

I think it's simply because you forgot to actual set the position of the line. You do that in the first state, but you don't in the state where you animate the float.

That did the trick! (And I ended up going with an Ease Float as mdotstrange suggested.) Thanks for assuming that I started off with enough knowledge for this to have been a case of forgetfulness. :) But it actually never occurred to me that I'd have to put a Set Position in the second state. I figured with it having been set to update every frame in the first state, and then with the float interpolating in the second, that Position would just keep updating. But I guess when you move to another state, you can't expect other states to remain in effect. Again, I'm plowing into this will a severe lack of basic coding knowledge, which tends to obscure what should otherwise be obvious.

Thanks very much for your help!

-Spencer

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 Learning the hard way means you'll never forget it :)

 Indeed, a Fsm can only have one state active at a time, and so for complex beahvior, several Fsms is usually required, each dealing with a particular role, and together forming a behavior that can handle multiple states.

 so typically in your case, you'll need very soon to have a dedicated fsm to move line, and a dedicated fsm to build the UI, and they will both communicate via either global events or by accessing variables via "get/set Fsm xxx" actions.

Bye,

Jean