Setting up Screen_to_World function for projection camera (SOLVED)

Hello, I am very new to defold and game design as a whole and I’m struggling to make a working screen to world module script to properly find world coordinates. Currently, I have a cursor script set up where I text follows the mouse cursor around indicating what the world coordinates my cursor is at. I had it all working completely when checking the orthographic camera property on my camera that views to whole tilemap for my level. However, when I try to uncheck the orthographic camera box I can’t figure out how to make my screen to world function in my module for screen to world handling to work. Currently, i have it working with the orthographic camera using the script from the screen to world example from defold examples. Are there any resources for figuring out the screen_to_world conversion for projection camera?

Screen to world conversion is different for the perspective mode. Look at the module from the “Entity Picking” example - examples/input/entity_picking/example/camera_math.lua at master · defold/examples · GitHub

PS I wanted to add a second example on screen to world specifically for perspective, but as usual in life, other tasks came up.

3 Likes

thanks, that worked

1 Like