Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: WarpZone on December 27, 2016, 12:28:34 AM

Title: Why is my FSM stuck in the "RunningRight" state? (See picture)
Post by: WarpZone on December 27, 2016, 12:28:34 AM
My player character (1) sometimes gets "stuck" running to the right.  By which I mean I can take my hands off the xbox controller, and it keeps running to the right.  Only pressing the left or right inputs gets it unstuck again.

As you can see, the RunningRight state (2) checks every single frame to see if either the left stick or the left d-pad are currently not pressed. (3)  It does this using the value stored in XSpeedAbs.(4)

(Yes this is a terrible name for this value but whatever, I can refactor it at any time.)

As you can see, at the time when I took the screenshot, XSpeedAbs = 0.  WHY isn't at least one of those triggering a state transition?  The tooltip for InControl Get Control Value says it "Values are typically in the range -1.0 to +1.0," so 1= pressed, -1= not pressed, right?
Title: Re: Why is my FSM stuck in the "RunningRight" state? (See picture)
Post by: gozda on December 27, 2016, 04:03:10 AM
Your float compare waiting when your value of "XSpeedAbs" will be less than 0.125. You put value 0.125 as tolerance so if "XSpeedAbs" have value 0, this 0 is equal to 0.125, not less ot greather.

This looks like when you pressed button value can be 1 but when unpressed i think its 0, not negative value.