Another devlog as I continue to work on my other project that uses this engine as a dependency. Since I’ve been actually using this engine for making something real, I’ve noticed that it has quite a few flaws that I didn’t catch earlier on in the creation process. For example, when the window resized on the Y axis, the scale of the content within the window would also scale. This actually ended up causing a big issue with my new project as I had to convert screen-space mouse coordinates to positions in the world for placing objects in the editor. Fixing this was pretty simple and I just swapped out the old render resolution for a render scalar that gets multiplied by the window resolution to calculate the render resolution.
Over the time of creating my new project there have also been some other small issues with things such as the button hitboxes and the engine not having the ability to resize objects in real time that I have since fixed.
For the real time object resizing issue though, it was especially annoying because I had to resize the THREE.js Mesh object directly using the .scale.set() method on it which cannot be simply supplied with the size in pixels you want the object to be and is separate from the size of the geometry. To solve this I had to calculate how much I would have to multiply the scale of the geometry by to get the new scale. This ends up being the math equation, newScale / originalScale.
Attached to this devlog are images, showing the window scaling fix in action as well as the scaling fix as it is used in my game. Now the scale of pixels stays exactly the same regardless of the scale of the window, and the 2nd block shown in the image with the Tiles picker is being scaled and rotated when the player hovers it.
Overall, this project is becoming quite a bit larger than I originally intended as I work on it more while actually using it to make a real game. Thanks for reading this devlog!