Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: realblues on May 02, 2012, 11:17:18 PM
-
When I changed NGUI Camera size to 100, some methods seems not work properly like scrolling, Panel clipping.
because I was working sprites with 2D toolkit before.
problem was, new Scene's Default orthographic camera size set to 100, not 1, so every working was set to it includes animation.
now I got camera size 100 for sprite objects and 1 for NGUI.
but sometimes UI needs interactive with sprites position, it requires many coordinates converting now.
is there good solution?
-
Could you please describe the math behind this? I am having problems with touch input due to the same problem: http://www.tasharen.com/forum/index.php?topic=245.0 (http://www.tasharen.com/forum/index.php?topic=245.0)
-
When you create a new UI using NGUI's "Create New UI" wizard, it will set the camera's size to be 1. Unity defaults to ortho camera size of 100 only if you create it yourself manually. '100' doesn't make sense as it has no relation to screen size in either view space (which is 1), or screen space (which is the height of your screen).
Change your 2D Toolkit's camera to 1, then shrink the root object of what it sees by 1/100th by setting its scale to (0.01, 0.01, 0.01).
-
Could you please describe the math behind this? I am having problems with touch input due to the same problem: http://www.tasharen.com/forum/index.php?topic=245.0 (http://www.tasharen.com/forum/index.php?topic=245.0)
Math behind this? As in, the conversion math? You'll need to read Unity's docs. I didn't code it. Btw, since the ortho size of the camera is '1', it makes sense that the origin of your ray is no more than 1 in any direction. Think about it -- add a box into the scene at the camera's position. By default it's also the size of 1, meaning it will cover the camera's volume nicely. When you convert from screen to world, you get a point inside that box.
-
Reduding sprite size works well, Thanks :)