Why does Ebitengine require the step to center my sprites over the origin before every Scaling, Rotation, and Translation combination #2793
-
I do understand most of the fundamental math for why you must be centered on the origin. I guess my question is why don't images default to centered over the origin. I'm doing my best to implement a Scaling, Rotation, Translation matrix pattern (which you have all the tools to do built into the engine for) But I find myself having to move by an offset of- 1/2 width and -1/2 height before and then 1/2 width and 1/2 height after. This feels wasteful (but I'm not having issues hitting 60FPS yet so it doesn't really matter I guess) I'm mostly wondering why, fundamentally, do we need to do this work to center our images to get rotation and scaling to "work" right? Is there something I'm missing I can do to make it so this isn't required? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's because I decided so. If the default origin position was the center of the source, you would need offsetting by 1/2 width and 1/2 height for every tile when you rendered tiles like https://ebitengine.org/en/examples/tiles.html. So, there would be another troublesome in the other way. |
Beta Was this translation helpful? Give feedback.
It's because I decided so.
If the default origin position was the center of the source, you would need offsetting by 1/2 width and 1/2 height for every tile when you rendered tiles like https://ebitengine.org/en/examples/tiles.html. So, there would be another troublesome in the other way.