PlayMaker Feedback > Action Requests

Get Float Right

(1/1)

westingtyler:
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:
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

Navigation

[0] Message Index

Go to full version