Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jarrah

Pages: [1]
1
Misc Archive / Concealed Intent, made with NGUI
« on: February 18, 2015, 11:20:46 PM »
Hi all,

I'm working on Concealed Intent, a turn-based game of tactical stealth space combat. It uses NGUI for all its UI needs  :)

It is on Steam Greenlight right now (please vote for it) at http://steamcommunity.com/sharedfiles/filedetails/?id=394572500



There is also a Concealed Intent website & blog.

2
NGUI 3 Support / Re: Issue anchoring with non-standard cam rects
« on: October 23, 2014, 08:05:08 PM »
What happens with one camera can affect the other, if an object shown by one camera is anchored to an object shown by the other camera.

I have an object in the 3d scene shown by the main camera. It has a HUD element anchored to it shown by the UI camera. When the main camera has its view port changed then the anchored HUD is no longer in the right place. The HUD is positioned where the 3d scene object would be if the viewport was NOT modified. I fixed by changing the anchoring code as shown above (which takes into account the change in the viewport).

3
NGUI 3 Support / Re: Issue anchoring with non-standard cam rects
« on: October 22, 2014, 06:32:36 AM »
It is not the screen ratio, it is the camera viewport ratio. Maybe I'm not using terms properly. I have attached an editor screenshot. The bit circled in red has changed for the main camera, but the ui cam has the original X & Y =0, H & W = 1. So the 3d world is in a narrow band across the center ("letter box") but the ui can use the whole screen.

Does that make more sense?

4
NGUI 3 Support / Issue anchoring with non-standard cam rects
« on: October 22, 2014, 04:00:28 AM »
Hi,

I hit an issue with NGUI 3.7.3 today. In my game sometimes the main camera is set to a "letterbox" screen ratio while the ui camera remains unchanged - thus the items in main cam 3d space are in a letterbox frame, while the ui cam can continue to draw the ui outside this frame.

When this happens UI elements anchored to 3d objects do not line up properly.  When translating between camera views, a change in the target camera's rect does not seem to be handled.

I think I managed to fix this by changing UIRect's GetLocalPos method (starting line 365) as shown below. Is there a better way to do this?

Thanks

  1. protected Vector3 GetLocalPos (AnchorPoint ac, Transform trans)
  2.         {
  3.                 if (anchorCamera == null || ac.targetCam == null)
  4.                         return cachedTransform.localPosition;
  5.        
  6.         Vector3 viewPos = ac.targetCam.WorldToViewportPoint(ac.target.position);
  7.         Vector3 pos = mCam.ViewportToWorldPoint(new Vector3((viewPos.x * ac.targetCam.rect.width) + ac.targetCam.rect.x, (viewPos.y * ac.targetCam.rect.height) + ac.targetCam.rect.y, viewPos.z));
  8.                 if (trans != null) pos = trans.InverseTransformPoint(pos);
  9.                 pos.x = Mathf.Floor(pos.x + 0.5f);
  10.                 pos.y = Mathf.Floor(pos.y + 0.5f);
  11.                 return pos;
  12.         }
  13.  

Pages: [1]