I know it should be easy but im getting old...
Say i have a variable number of objects (at least 1)
and a float value from zero to one
I need to select the object that is the closest match to the float.
so if i have 5 objects and the value is 0.5 I want the 3rd object.
if the value is 0 i want the first object (object 0). if its 1.0f i want the 5th object (object 4)
This needs to work for every value from 0 to 1.
I bet this can be done in 1 line of C++, I just cant concentrate
Its not good enough to just cast an int, I need it to be the closest match without rounding in an arbitrary direction.
Cheers!



Reply With Quote

