playMaker

Author Topic: Compare multiple floats?  (Read 1778 times)

derkoi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Compare multiple floats?
« on: October 16, 2013, 03:41:25 AM »
I need to check if a 2 float values are above a values and if they are transition to next event.

Is there a way I can do this with multiple float compare actions or will i need something else?

Thanks

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Compare multiple floats?
« Reply #1 on: October 16, 2013, 04:13:54 AM »
You could use two Float Compare's, store as bools, and use a Bool All True to fire the event.

*edit

just noticed float compare cant store as bool, so you'd have to exit the state and switch the bool or do something else to modify the bool.
« Last Edit: October 16, 2013, 04:15:26 AM by Lane »

derkoi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Compare multiple floats?
« Reply #2 on: October 16, 2013, 04:20:24 AM »
I cant really exit the state as it's translating the object every frame. I know i could translate in the next state but I'd rather keep things tidy if possible.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Compare multiple floats?
« Reply #3 on: October 16, 2013, 04:35:40 AM »
You could use a Float Operator to add the Floats together, then Compare the total stored float and send an event off of the Greater Than.

That could create issues though... If one number goes too high it will fire the event for example. It's very conditional.

Sounds like you need a second FSM doing those calcs and sending the results back. Either that or modify the Float Compare action to store a bool actively.

derkoi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Compare multiple floats?
« Reply #4 on: October 16, 2013, 04:48:39 AM »
I was thinking about modifying the compare float action to use the && condition and fire an event?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Compare multiple floats?
« Reply #5 on: October 16, 2013, 05:34:06 AM »
I went ahead and made an action with bools.

http://hutonggames.com/playmakerforum/index.php?topic=5198.0

derkoi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: Compare multiple floats?
« Reply #6 on: October 16, 2013, 06:03:57 AM »
Awesome, thanks Lane  8)