Hello everyone,
I have an orthographic camera of size 100, and I have a plane that I want to fit/scale according to the screen size.
To be more clear, I want the functionality of a guiTexture on a plane/mesh.
In the case of a guitexture, I would have set transform.postion = vector3(0,0,0) and play with the values of pixelInset like:
myGuiTexture.pixelInset = new Rect(0,0,Screen.currentResolution.width,Screen.currentResolution.height);
So how to achieve something like this with transform.position or any other method to do this with 3D object.
I want this since I am using tk2d and I want my sprite animation to fill the whole screen.
Thanks,
@robertbu thank you for your support.. Here's my script: transform.localScale = new Vector3(cam.orthographicSize/2 * (Screen.width/Screen.height),cam.orthographicSize/2,0f); but its not fitting perfectly, the width is smaller than screen width (there are narrow vertical columns on both sides), and the height is more than Screen.height.. what might be my fault?
– moghes@robertbu thank you again, but I am using 2DToolkit, and I have a sprite , how to know how big it is? Its scale is (1,1,1) ..
– moghesI don't know 2DToolkit, so I don't know how they size things. Do they base size and/or aspect based on the texture, or do you enter the size as part of a script? As a starting point, take a sprite with a square texture and compare it to a thin cube.
– robertbuThis Script is not working for me the plane is musch bigger then the screen.
– AlexeyGaponIt's doesn't working because Screen.width/Screen.height and cam.orthographicSize/2 is integer try: Screen.width/(Screen.height*1.0f) or some like this
– aloska