- Home /
Question by
Tofudude624 · Mar 17, 2014 at 09:23 PM ·
resolution
Relative screen positions.
Hello. In anticipation of porting my project to multiple devices with different resolutions, I decided to base all transform positions off of the screen coordinates. For example, if I want to spawn something just outside of the user's view I would find the position of a point 1/8 of the screen's width past the right side of screen and then instantiate the object there. This simple script I created is an example of that (it always places MyObject in the upper right corner of the screen). My question is this: is this a good idea?
var MyObject : GameObject;
var corner : Vector3;
function Start () {
corner = camera.ScreenToWorldPoint (Vector3 (Screen.width,Screen.height,10));
MyObject.transform.position = corner;
}
Comment