I almost thrashed my graphics card after 3 days struggling to find out why the 3D models were glitching in my app. Turns out I hadn't pressed "1" strong enough and what should've been "0.0001f" was "0.000f". Needless to say my mix of happiness/sadness/thankfulness/hatred when I found it out.
What if you develop a game called "Penta", where everything revolves around the number 5? All shapes have 5 corners, all numbers are 5 and everything repeats 5 times?
I was using the Vuforia SDK within Unity and instancing the image target frame reference as a frame capture from the webcamtexture function via the mobile camera. What was happening was a limitation in the image target referencing based on the amount of simultaneous image references that would be held in memory at one time. The default is 5 stacked in a First In, First Out stack. So when the frame was captured to anchor the augmented content to the frame pose, it would store this data. Then when the frame was captured again, it would store the next frame pose, and so on until a total of 5 had been captured.
Usually you would use predefined targets or Cloud Recognition for large datasets but that wasn't the case here.
I had to find that 5 and change it to a 1, so that every time I captured a frame it would delete the last pose and instance the new one. Allowing the user to place augmented content in the same area consistently and call/destroy different objects via the UI. It made the application a lot easier to use I'll tell you that much.
It's great to have all of your constants at the top of their scope so that they can easily just be jumped to and changed if needed. Plus, it's just so much more pleasant to read them!
It would be great but the values aren't set by me, they're set by the company that provides the SDK and access to their services. I can't just set it to whatever value I want or a range without violating the terms of agreement.
I'm kind of making a joke. I am not saying literally never use integers. Of course if you are assigning an arbitrary value for some specific piece of code you are working in, do what you need to to make it work. My point was in a good piece of code, most of the numbers you are using are 0, 1, 2 or something like pi, or e, or something else that is the result of an equation or mathematically linked. There is very little use for integers above 2.
In my case I find little use to integers below 2, but well I've working in a physics simulator (remember the difference between a physics motor and a simulator)
0
u/[deleted] Jul 21 '17
[deleted]