Log in or register to post comments

Unity 4.6 UI scaling as child of Image Target issue

December 24, 2014 - 3:09am #1

Hi,

I'm using Unity4.6 to create an AR browser with the Cloud Reco feature. For an implementation, I want a Unity canvas as a child of my cloud reco target. I notice that this canvas doesn't scale with respect to the image target it is parented to. No matter what image I scan as a cloud reco target, the canvas remains at its original scale. Is this a known issue or is there a workaround for this?

Unity 4.6 UI scaling as child of Image Target issue

January 2, 2015 - 8:22am #4

What happens if you reduce the width and height, from 480 to something lower ?

If I understand correctly what you're doing,  you are using World Space mode and setting both the Scale and the Width+Height to something "big" (256 and 480); the resulting overall size of the canvas should result from the multiplication of those numbers, because the Width and Height in World Space mode are mapped to scene units (which will make your UI explode in size); so, in this case you'll probably want to ultimately use a scale which is not "purely" the size of the Target (e.g. 256) but a value that is computed by dividing the target size by a number like "480" (or whatever value you have set the width and height), or something along those lines;  

all I was saying in my previous post is that your intermediate object can be a good starting point to have a "base scale" of 1,1,1, so that the subsequent size and scale can be "chained" on top of that.

I hope it makes sense.

There is also a nice tutorial about canvas scaling in World Space mode:

http://blogs.unity3d.com/2014/06/30/unity-4-6-new-ui-world-space-canvas/

 

 

Unity 4.6 UI scaling as child of Image Target issue

January 2, 2015 - 4:34am #3

Hi AlessandroB,

I'm using a world space UI canvas and tried implementing the intermediate object method, but as I suspected, it didn't work. For example, I set the size as 256 in my target manager when I create an Image Target. I'm using CloudReco and I've set the UI canvas in my scene to completely cover the cloud reco object. For this, I've to set the scale of the canvas to a very low value (0.00021, 0.000021,1) and set the width and height to 480. Now when I set the localScale of the intermediate object to the size of the ImageTarget, which I get as 256, it messes up the whole UI in the sense that it scales the UI 256 times. Is this issue resolved in Vuforia 4.0? Or is there a workaround for World Space Overlays?

Unity 4.6 UI scaling as child of Image Target issue

December 24, 2014 - 4:25am #2

Try adding an internediate empty game object between the target and the canvas, then set the transform.localScale of the "intermediate object" to the size of the recognized target.

 

In practice,

The hierarchy in the scene should be as follows:

  •   ImageTarget
    •       intermediate object (child of ImageTarget)
      •         your object (e.g. canvas or whatever you like, child of "intermediate object")

 

Log in or register to post comments