Log in or register to post comments

Camera Direction

May 22, 2015 - 10:42am #1

Vuforia SDK Version: 4.2.3 -

Description with steps to reproduce:

Hi i was using Vuforia 4.0.1 And everything was fine but when i upgraded to 4.2.3 i ve found problem with camera Direction and im using iphone 6 and Unity 5.0.2.

So My Problem is i have a scene witth AR and Another scene is MainMenu,

So When you go to AR scene everything works fine but when you Change the Camera to Front Camera by using this code:

using UnityEngine;
using System.Collections;
using System.IO;


namespace Vuforia
{
	public class FrontCamera : MonoBehaviour {
		
		
		private bool on = true;
		public enum VideoBackgroundReflection
			
			
		{
			
			DEFAULT,  // Allows the SDK to set the recommended reflection settings for the current camera
			
			ON,       // Overrides the SDK recommendation to force a reflection
			
			OFF       // Overrides the SDK recommendation to disable reflection
			
		}
		
		
		
		
		void OnClick () {
			on = !on;
			if(on)
			{

				CameraDevice.Instance.Stop();
				CameraDevice.Instance.Deinit();
				TrackerManager.Instance.GetTracker<ObjectTracker>().Stop();

				CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_BACK);	
				QCARRenderer.VideoBackgroundReflection MirrorVideoBackground = QCARRenderer.VideoBackgroundReflection.OFF;
				CameraDevice.Instance.Start();
				TrackerManager.Instance.GetTracker<ObjectTracker>().Start();
				
			}
			else if(!on)
			{

				CameraDevice.Instance.Stop();
				CameraDevice.Instance.Deinit();
				
				TrackerManager.Instance.GetTracker<ObjectTracker>().Stop();
				CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_FRONT);	
				QCARRenderer.VideoBackgroundReflection MirrorVideoBackground = QCARRenderer.VideoBackgroundReflection.ON;

				CameraDevice.Instance.Start();
				TrackerManager.Instance.GetTracker<ObjectTracker>().Start();
				
			}
			
		}
		
		
		
		
		
	}
}

And when you are still in Front Camera try to go another scene(MAinMenu) and come back to AR scene The Rear Camera is Upside down!!!

But if you from Rear Camera go to main menu and come back to AR SCene everything is Fine!!

Please Help me how im gonna get rid of this Upside down view?

Are you guys gonna resolve this thing in your new version?? 

-

Development OS (Mac OS X, Windows, Linux): Unity 5.0.2 OS 10.10.3 -

Mobile OS and Version: 8.3 -

Mobile Device Manufacturer and Model name: iPhone 6 -

Do the Vuforia Sample Applications show the same behavior?:

Camera Direction

May 27, 2015 - 11:38am #7

That might happen if the OnSceneWasLoaded is executed before Vuforia has finished initializing;

so, a safer way would be to register an OnQCARStarted callback and execute the code from there:

void Start() {

  QCARBehaviour qcar = (QCARBehaviour) FindObjectOfType( typeof( QCARBehaviour) );

  qcar.RegisterQCARStartedCallback( OnQCARStarted );

}

private void OnQCARStarted() {

     // put your camera direction reset code here

}

 

Camera Direction

May 27, 2015 - 9:32am #6

Thanks for your help and its working awesomeeeeee!!!

but im getting this error!

Failed to set frame format
UnityEngine.Debug:LogError(Object)
Vuforia.CameraDeviceImpl:SetFrameFormat(PIXEL_FORMAT, Boolean)
Vuforia.CameraDeviceImpl:ForceFrameFormat(PIXEL_FORMAT, Boolean)
Vuforia.CameraDeviceImpl:Start()
Vuforia.FrontCamera:RestartCamera(CameraDirection, Boolean) (at Assets/Scripts/Camera/FrontCamera.cs:57)
Vuforia.FrontCamera:OnLevelWasLoaded() (at Assets/Scripts/Camera/FrontCamera.cs:18)
 
and when i doubble click on it, it opens the the last line of the code that im using for reseting the camera at:
CameraDevice.Instance.Start();
 
any idea?? should i just ignore it???
Thanks
 

Camera Direction

May 27, 2015 - 8:51am #5

Have you tried resetting the Camera direction and mirroring in the OnLevelWasLoaded() method of your script:

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnLevelWasLoaded.html

 

The code to reset the camera direction is the same that you can find here:

https://developer.vuforia.com/forum/faq/unity-how-select-camera-and-mirroring

 

Camera Direction

May 27, 2015 - 8:29am #4

I know everythings works good, but when you are in the front camera and quit the AR scene and re enter that scene the front camera video is upside down!

AttachmentSize
Image icon IMG_3607.JPG227.98 KB

Camera Direction

May 27, 2015 - 8:22am #3

Camera Direction

May 27, 2015 - 7:42am #2

ANYONE???? PLEASE HELP ME!!

Log in or register to post comments