Convert virtual to real position


#1

Hi guys! I’m creating a shader that draws line from p1 to p2 where p1,p2 - game objects with virtual coordinates. Also I’m using custom render script that fixes aspect ratio. How can I convert virtual coordinates to real?
I already tried p1.x + (real_width / virtual_width) / 2 and .lua script from that repository but it doesn’t work on smaller screen size. For example, if my virtual resolution is set to 1280x720, then it works fine on 1300x800, 1600x900 etc., but on 960x640 it brakes :worried:


#2

What happens when it doesn’t work? Could you describe the problem or post a screenshot?


#3

I didn’t resolve the problem but I don’t use shaders now.
You can close the topic :slight_smile: