Very precise hitbox coordinates

Because I’m working with angled shapes this time around, I’ve run into an issue trying to set the coordinates of the hitbox. The shape in question is a parallelogram, where the length of all sides is 90px, the obtuse angle is 135 degrees and the acute angle is 45 degrees (think squashed diamond).

This shape is joined to a square (with 90px sides) to form a “boot” shape.
In order for the completion test to work, any convex corner must be cut off (I don’t want to test for touching corners since it can give a false positive). Since the “boot” shape is by definition concave (and therefore illegal for GDev hitboxs, I split the the hitbox into 2 parts.

The issue:
When I’m mapping the coordinates, I enter the values (precision is very necessary here), and find that some values do not stay as entered - for example, if I enter and X, Y pair as 62.7 , 1.8, the value that shows up is 62.70000076293945, 1.7999999523162842. After experimenting, I have found that the only numbers not subject this this issue are integers, and floating point numbers where the decimal value is exactly .5

If you enter 1.2 in a coordinate box, the blown out 16 digit decimal will automatically appear, and you can’t use the arrow key or delete key to remove the excess digits.

I doubt that anyone actually needs 16 decimal digits of precision - especially since most people use the GUI to set the hit box points and the GUI isn’t precise enough to warrant that many decimals.

I’m not sure how complex this will be to fix, so I will live with the ‘close enough’ values. I just wanted @4ian to be aware that the issue exists. I have a stripped down example (just the once shape and hit boxes defined) I can send if needed.


Thanks for reporting - this is due to how the floating point numbers are represented in a computer memory (not by itself a GDevelop issue). I’ll do a fix in the UI to avoid showing all these decimal digits that are confusing. You can live with the “close enough” values for now, this should be auto-corrected in a future version :slight_smile: