Log in or register to post comments

Create a Custom Viewer Type

August 13, 2017 - 4:34pm #1

Hello,

I created a Custom Viewer Type inside Digital Eyewear and I'm trying to access it during runtime using:

IEnumerable<IViewerParameters> viewerParameters = Device.Instance.GetViewerList().GetAllViewers();

  foreach (IViewerParameters vp in viewerParameters) {

   if (vp.GetName ().Equals ("Custom")) {

    MixedRealityController.Instance.SetViewerParameters (vp);

   }

  }

but it isn't working. I run Debug.Log (vp.GetName()) and found out that "Custom" isn't showing as an option, only "Cardboard v1", "C1-Glass", "VR Goggles" and "VR ONE". 

How can select the Custom Viewer Type via script?

Thanks,

 

 

 

 

 

Create a Custom Viewer Type

August 16, 2017 - 8:38am #2

Hello cronem,

That list will only contain the eyewear devices officially support by Vuforia. If you would like to select a custom viewer at runtime, you'll need to create an instance of a customer viewer at runtime and set this as the current viewer.

Here is some example code on how to do something like that:

var newViewer = Device.Instance.CreateCustomViewerParameters(1.0f, mCustomName, mCustomManufacturer);
newViewer.SetScreenToLensDistance(mCustomScreenToLensDistance);
newViewer.SetInterLensDistance(mCustomInterLensDistance);
newViewer.SetLensCentreToTrayDistance(mCustomLensCenterToTrayDistance);
newViewer.AddDistortionCoefficient(mCustomDistortionCoefficients.x);
newViewer.AddDistortionCoefficient(mCustomDistortionCoefficients.y);
newViewer.SetFieldOfView(mCustomFieldOfView);

mEyewearBehaviour.SetViewerActive(false);
Device.Instance.SelectViewer(newViewer);
mEyewearBehaviour.SetViewerActive(true);

If you are developing a custom OEM and would like to discuss getting it added as an official Vuforia device, you can contact our sales team and work with them to begin that process.

You can reach them through this form:

https://developer.vuforia.com/contact-sales?source=contact-sales

or by email at:

vuforia-sales@ptc.com

Thanks,

-Vuforia Support

Log in or register to post comments