Topic locked

Choose camera direction before and during AR scene

March 4, 2014 - 9:51pm #1

Hi, I need choose wich camera the user want to use for the AR content, I found on the docs this:

CameraDevice.Instance.Stop();
CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_FRONT);
CameraDevice.Instance.Start();

to change camera while the AR scene is playing.

But I want to know how I can choose the camera before entering to the AR scene, I know that one can choose this from the inspector on unity but, I need on the game give the option to the user on the settings scene, so I couldn't find the answer.

So if anyone know how to do it?

Choose camera direction before and during AR scene

March 11, 2015 - 12:47am #7

You're welcome.

Choose camera direction before and during AR scene

March 10, 2015 - 1:26pm #6

Thanks, the using Vuforia; was the key, but it's a shame that I can't access to the webcamera, I hope on a near future this feature is added.

Choose camera direction before and during AR scene

March 10, 2015 - 12:03pm #5

On Android, Vuforia supports the rear and front cameras that are embedded in the device.

 

About the migration to 4.0:

In 4.0, instead of registering the ITrackerEventHandler you can simply register the initialization callback, e.g.:

void Start()

{

  QCARBehaviour qcar = GetComponent<QCARBehaviour>();

  qcar.RegisterOnQCARInitializedCallback( MyQCARInitializedCallback );

}

 

private void MyQCARInitializedCallback ()

{

// your code

}

Also, you need to add this line at the top of you scripts:

   using Vuforia;

 

Choose camera direction before and during AR scene

March 10, 2015 - 11:24am #4

Sorry just another question, I have connected a webcamera (logitech c920) to my android smartphone, is possible to choose the webcamera instead of the back or front camera, something like on this video where they use the webcamera.

https://www.youtube.com/watch?v=FLodRbC164k

 

PD. I just migrate my project from vuforia 3 to vuforia 4 and now it doesn't work the ITrackerEventHandler, and also I can't access to QCARBehaviour to change the camera on realtime, any solution?

Choose camera direction before and during AR scene

March 10, 2015 - 10:48am #3

Thanks it works

Choose camera direction before and during AR scene

March 4, 2014 - 11:22pm #2

You can switch the Camera direction as soon as the AR scene starts, by implementing the ITrackerEventHandler interface in a custom script, attach the script to the ARCamera and register it (as ITrackerEventHandler) with the QCARBehaviour. Something along the lines of:

void Start()

{

  QCARBehaviour qcar = GetComponent<QCARBehaviour>();

  qcar.RegisterTrackerEventHandler( this );

}

Then, in the OnInitialized() method of your ITrackerEventHandler, you can put your camera initialization code, where you choose the direction.

Also, at any point in timeduring the game, you should still be able to switch the camera direction, by stopping the camera and reinitialize it again with the new chosen direction.

 

Topic locked