Hey guys,
just bought playmaker some days ago, and I'm loving it
I'm now looking to reimplement some parts of my game with it.
I won't explain the whole game here as it will be a little too long and off topic but let's say I'm trying to program a kind of "Worms-like" game (the view is like a side scroller and characters walks along the terrain, and can fall if they're being shot at...)
To make my character walk I use a character controller that I deactivate when they are falling. At this moment I activate another Collider and sets a rigidbody "is Kinematic" property to false to make my character fall along the terrain. It works great and I'm now looking for a "playmaker" way to test if my rigidbody's speed is under a given value for X seconds.
I currently have a working solution, but as long as playmaker debug log is active I get a lot of "Infinite loop" logs, and if I set the "inifite loop thresold" to an higher value, I get Stack Overflow exceptions. Despite the loss of FPS due to the many logs, the FSM runs without any problem.
I attached a screenshot of my current FSM.
My StopCheck state works like this :
- it sets a "timeSinceStopped" variable to 0 once when entering the state
- it adds the deltaTime to "timeSinceStopped" each frame
- if the rigidbody's speed is above the min speed I've set, I emit the DidMove signal. It makes the FSM start the StopCheck state again (so timeSinceStopped is set to 0 again)
- if timeSinceStopped variable is above a given value, it emits the IsStopped signal that makes the FSM switch to StandUp state
Is this a wrong way to do what I'm trying to do ? Is there a better way ? Is it better to avoid having too many state change in a FSM ?
The best way I'd see yet to solve this problem would be to code an action that does the same as above without needing a state change, it would be very simple to do that but I was asking myself if there's a better way to do that with what we already have in playmaker.