Hi
New project
Camera ortho size=1 scale 1,1,1 position 0,0,-10
Background=GameObject 800wd x 480ht pixels. scale 1,1,1 position 0,0,10
Rectangle=GameObject 120wd x 400ht pixels scale 1,1,1 position 0,0,0
When I click on my GUI button, i want to place the rectangle object so that its left edge aligns with the left edge of the Background and the bottom edge aligns with the bottom edge of the Background.
how do i do this?
I have messed arround with camera.ScreenToWorldPoint and camera.WorldToScreenPoint but cannot get it right.
Since 0,0,0 is the center of the camera in world points then -340 pixels to the left will make it happen.
From trial and error, i discovered that .004166666 is the world points/pixel so setting the position to (-1.416666,-.166666,0) works, I happen to know the pixel width and heights of my objects. But what if i didnt?
At runtime, how can i place my object at the correct location given the information that i have at runtime, like camera object, and the transforms of the two mesh objects?
Also the .004166666 worldpoints/pixel was obtained by trial and error. How do i calculate this at runtime?
Thanks
Jerry C