Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Bobyteal on January 07, 2017, 12:35:49 PM
-
Hi ;)
My brain is stuck on a problem, I am trying to build a ship that moves like this :
0 gear by default.
- You press Z => First gear => You gradually speed up forward until you reach 3 movespeed max (from your current movespeed up to 3).
...
- You press Z again => Second gear => You gradually speed up forward until you reach 6 movespeed max (from your current movespeed up to 6).
- ETC.
Now if you want to retro gear :
- You press S => -1 gear => You gradually slow down until you reach the precedent gear's movespeed max.
- You press S starting from gear 0 => First Retrogear (-1) => You gradually move backward until you reach -1 maxmovespeed.
- ETC.
Screenshot of my Unity :
http://imgur.com/a/2Wxr7
I hope I was clear enough, if you can help me it will be really great as it will also helps with my general understanding of playmaker !
-
Sounds like you need a multiplier-
So for setting your speed float- whenever you set it- multiply it by another float that will act as a multiplier- then you just change the multiplier to set the different speeds- you can change the multiplier float from within that FSM or outside of it as well.
-
Alright I will try it but how do you make gradual speed ? I mean going from 0 to 3 speed smoothly for example, like an acceleration ?
Thanks
-
You'll be tracking your current speed and your target speed in variables. You can use the "Float Interpolate" action to smoothly transition your current speed up to your target speed.