https://github.com/defold/sample-screen-to-world-coordinates
This sample project shows how to convert from screen to world coordinates while using a camera component.
https://github.com/defold/sample-screen-to-world-coordinates
Last synced: 3 months ago
JSON representation
This sample project shows how to convert from screen to world coordinates while using a camera component.
- Host: GitHub
- URL: https://github.com/defold/sample-screen-to-world-coordinates
- Owner: defold
- License: mit
- Created: 2024-01-03T15:26:38.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T05:44:22.000Z (over 1 year ago)
- Last Synced: 2025-01-30T15:23:52.274Z (12 months ago)
- Language: Lua
- Homepage:
- Size: 62.5 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This sample project shows how to convert from screen to world coordinates while using a camera component. The conversion is made in the `screen_to_world(camera, x, y, z)` function in `camera.lua`.
The project also shows how the `screen_to_world()` function can be used to anchor game objects to the corners of the screen regardless of screen resolution and aspect ratio.
## Credits
Graphics by [Kenney.nl](https://kenney.nl/)