melonjs / melonJS

a fresh, modern & lightweight HTML5 game engine
https://melonjs.org
MIT License
5.93k stars 643 forks source link

Fix Camera2d.WorldToLocal to translate game.world.pos also #1222

Closed pathak-prashant closed 8 months ago

pathak-prashant commented 8 months ago
Description of change

WorldToLocal applies transformation on the passed vector if the camera has transformation applied to it, however it does not apply it to the game.world.pos which is added to get the file result. This results an incorrect world to local translation. This change copies the world pos vector to a local variable and applies transformation to it, before adding it to the vector.

Merge Checklist
pathak-prashant commented 8 months ago

Cannot complete merge checklist as unable to run npm run lint because of attached error,

pathak-prashant commented 8 months ago

Something is not right. Checking more on this.