playMaker

Author Topic: Get Float Right  (Read 261 times)

westingtyler

  • Full Member
  • ***
  • Posts: 221
    • View Profile
    • My Oculus Rift + Touch VR Game Using Playmaker
Get Float Right
« on: November 13, 2018, 11:48:38 AM »
Hello. I need an action that gets the rightmost two places of a float variable. currently I have to convert the float to a string, get string right 2, then convert that to a float again.

so if the input float is 632, the result of this action would be 32.

also it would be great to have a similar one for get float left. thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14048
  • Official Playmaker Support
    • View Profile
Re: Get Float Right
« Reply #1 on: November 13, 2018, 11:10:47 PM »
Hi,

 https://stackoverflow.com/questions/701322/how-can-you-get-the-first-digit-in-an-int-c

So yes getting the string is the slowest, but if you are not using this every frame during your game loop, you'll be fine.

 what is this number in your game and how often do you want to perform this check? maybe there is a way to get to the source of the generation of this number and get the data there instead of after?

Bye,

 Jean