playMaker

Author Topic: Float: Find closest multiple of [SOLVED]  (Read 3205 times)

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
Float: Find closest multiple of [SOLVED]
« on: April 09, 2013, 09:18:55 PM »
Hey,

Wondering if it would be possible to have an action to test a float for the closest multiple of another float.
For example, you retrieve the Y rotation of a game object, then find the closest multiple of 90, you could tell it to look towards up down left or right, if that makes sense.

Many thanks in advance,
Mark.
« Last Edit: April 13, 2013, 01:38:35 AM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float: Find closest multiple of
« Reply #1 on: April 11, 2013, 02:21:05 AM »
Hi,

 try this:

http://hutonggames.com/playmakerforum/index.php?topic=2964.msg13556#msg13556

it's a modulo operator action, I think this is what you want:
http://en.wikipedia.org/wiki/Modulo_operation

bye,

 Jean

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
Re: Float: Find closest multiple of
« Reply #2 on: April 12, 2013, 11:17:27 PM »
Awesome!
Thanks again, Jean! I probably owe you lots of beers by now.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float: Find closest multiple of [SOLVED]
« Reply #3 on: April 15, 2013, 02:02:12 AM »
I guess I would be very drunk by now...  :P