Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: westingtyler on November 13, 2018, 01:48:38 PM

Title: Get Float Right
Post by: westingtyler on November 13, 2018, 01:48:38 PM
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!
Title: Re: Get Float Right
Post by: jeanfabre on November 14, 2018, 01:10:47 AM
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