Open zommerfelds opened 3 years ago
I don't like hardcoded offsets as well :'( But there is definitely some reason for this, although I haven't played with 2D recently. Let's discuss first this in #776 for h2d.Graphics and see if it can be resolved for the sample I posted there, and then we can apply the same reasoning to SpriteBatch
For the SpriteBatch case: do you have an example to reproduce a problem? Since there are no lines there it feels like a different problem.
When you setup a scene with high scale (where a difference of
0.1
is visible), some primitives have a small value added that distorts the position. Examples:https://github.com/HeapsIO/heaps/blob/2215e97d4ba818ff7c95c3158e62021861e6821b/h2d/SpriteBatch.hx#L403
https://github.com/HeapsIO/heaps/blob/8f7f439116692013b4d9182acb633ba56283dabf/h2d/Graphics.hx#L563-L564
I think a scale like that is very reasonable, given some people recommend 1 unit = 1 m (depending on your world). However, the code was probably written assuming 1 unit = 1 pixel.
Maybe this is a duplicate of https://github.com/HeapsIO/heaps/issues/776 but I wanted to know if anybody knows the reason why we add
0.1
. I can create a PR to remove those, but they were probably added for a reason :)