Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: stansdad on May 21, 2014, 04:01:50 PM
-
Hi
I need an action similar to Float Compare, but to actually compare the difference between the floats, not just to see if it's less than, equal to, or more than.
i.e., I need to know if the difference between two floats is greater than 2 (a fixed value).
I'm trying to do a falling death based on Y distance fallen. I have the Y position stored as a variable at the point of exiting one platform and again stored when they hit the next platform.
If the distance between the two is more than 2 world units, player dies.
Any idea how I can achieve this?
thanks
-
Hmm sounds like it would be the point where you became ungrounded (positionA) minus the position where you become grounded (positionB) then save that as the difference and if its Greater Than 2 then death.
Should be able to do a vector3 operator and a float compare on the vertical axis difference.
-
Thanks Lane. I'll have a go and report back with a screenshot of an FSM that solves it.
-
Right I'm very close now. It's taken me a month. I've looked in this thread http://hutonggames.com/playmakerforum/index.php?topic=6309.0 (http://hutonggames.com/playmakerforum/index.php?topic=6309.0)
and found the following information
Using check if is grounded. If not get inicial Y position.
Then.
Check if is grounded. If yes get final Y position.
Float Operator Inicial-Final
Float Switch between your values.
With this you can hurt/kill your player.
Tip get position in world space.
Works ok, BUT, the "death" occurs at the point my character leaves the top platform, not when he hits the floor.
I've attached a couple of screenshots. I'm not sure if it's because of where the NO path leads on the second "Check if Grounded" state. I also tried feeding it back into itself but get a 1000 error loop
-
Fixed it
Just changed the second "Check If Grounded" FSM to "Every Frame"