Start a new topic
Solved

WikitudeCamera Change Aspect ratio Unity

Hi


Unity 2019.2.17

I need to change the WikitudeCamera Aspect ratio to fit inside a video box (small box inside the screen), but didn't work using the WikitudeCamera inside a RectTransform with anchors. 

I found in the documentations that "The WikitudeCamera prefab takes care about rendering the live camera stream fullscreen behind all your augmentations."


I'm using the Input Plugins API to supply the frame data.


So, I wonder if it is possible to resize it and how do it.


Thanks.


Hi Leo,


is there still a problem with displaying the camera render textures or is the input/placement mechanics not working properly? I just tried out the code for the scene picking controller and I found that it can't be working. The RawImage's rect position will not deliver the world position but the local position, which was wrong for the calculation. The following adjustments to the code did the trick for me:


      Vector3[] v = new Vector3[4];
      ARCameraRawImage.rectTransform.GetWorldCorners(v);

      adjustedPosition.x = (Input.mousePosition.x - v[0].x) * (Screen.width / (v[3].x - v[0].x));
      adjustedPosition.y = (Input.mousePosition.y - v[0].y) * (Screen.height / (v[1].y - v[0].y));
      adjustedPosition.z = Input.mousePosition.z;


Note: ARCameraRawImage is actually ARCameraRT from before (which was not well named back then).

Here is a link to the GetWorldCorners() method documentation from Unity. This method delivers all 4 world corners for any UI element and this then can be used to properly do the adjustment calculations (which formerly delivered wrong results and therefore wrong positioning).


Kind regards,

Gökhan

Great! Works like a charm!

Thanks!

Login or Signup to post a comment