Log in or register to post comments

Controlling camera focus in Unity plugin

May 8, 2011 - 6:35am #1

How can I control the camera focus in the Unity3d plugin?
Thanks

EDIT:
I figured out how to do this:
In Unity3d (project window), scroll to the folder named "Scripts". This is the scripts folder in the root of your project, and not the one in the Qualcomm Augmented Reality folder. There will be a file named "CameraDeviceMenu". Drag it onto "ARCamera" in the Hierarchy window on the left. Now if you run the application and click on the background, a menu will popup which allows you to focus the camera, use the flash as a flashlight, or change the focus modes.

Controlling camera focus in Unity plugin

March 9, 2017 - 2:30pm #40

Quote:

After last update Vuforai 6.2, que autofocus routine is not working.

this message in the error event:

Assets/Scripts/CameraFocusController.cs(14,21): error CS1061: Type `Vuforia.VuforiaBehaviour' does not contain a definition for `RegisterVuforiaStartedCallback' and no extension method `RegisterVuforiaStartedCallback' of type `Vuforia.VuforiaBehaviour' could be found. Are you missing an assembly reference?



Anyone can help??

Cheers

Jordi

 

Replace "VuforiaBehaviour" with "VuforiaARController" or version 6.2 will give that error.

Controlling camera focus in Unity plugin

March 2, 2017 - 2:14am #39

After last update Vuforai 6.2, que autofocus routine is not working.

this message in the error event:

Assets/Scripts/CameraFocusController.cs(14,21): error CS1061: Type `Vuforia.VuforiaBehaviour' does not contain a definition for `RegisterVuforiaStartedCallback' and no extension method `RegisterVuforiaStartedCallback' of type `Vuforia.VuforiaBehaviour' could be found. Are you missing an assembly reference?

 

Anyone can help??

Cheers

Jordi

Controlling camera focus in Unity plugin

June 2, 2016 - 3:38am #38

Hi,

I'm working on an iPad Air 2, I'd created a simple Vuforia scene with an ARCamera, 5-star tracker and a simple Cube augmenting from it. 

When I push it to the iPad, I find that the camera refocuses constantly; making the augmentation unstable.

I tried to add the following script to the ARCamera:

bool focusModeSet = CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);

But this still does the same thing (as I assume this is the default). I then tried with the function TRIGGERAUTO but the same happens.

Is there any way I can get round this or is it just what happens on iPad?

Thanks

Controlling camera focus in Unity plugin

December 15, 2015 - 2:26am #37

Hello there, may i ask where exactly to add the camera device focus mode code? I couldnt find any camera device.cs related files

Controlling camera focus in Unity plugin

May 7, 2015 - 5:56am #36

What is it exactly that you are trying to do because the part of the script you quoted seems to be swapping datasets on an ImageTarget if it contains more than 2 datasets, which you probably don't need.

If you just want to be able to recognize an image I would suggest looking at the ImageTarget sample app that is available in the downloads section (I think it's bundled together with all the other samples, so you just need to open up the right scene). Don't forget that you need to obtain a license key, then create and import datasets for the images you want to be able to track (looks at the guides if you don't know how to do that).

If you have other issues you should look on the forum for help or open a new thread if you can't find a solution. Regarding the camera focus simply use the line I wrote earlier in any of your scripts (create one and attach if to any gameobject if you need to). You can use any other enum value of CameraDevice.FocusMode, I just put continuous auto as an example, which may not even be supported by all Android devices.

Controlling camera focus in Unity plugin

May 7, 2015 - 3:28am #35

The script posted some messages ago is written for Vuforia 3, with deprecated ImageTracker now replaced with the ObjectTracker: so it is impossible to build the script. It gets errors from row 164 to 180, in particular with the GetTracker(). If I delete those rows it compiles but the resulting app (developed for Android) doesn't recognise the target image

 

// Swap data sets.
		if (GUILayout.Button("Toggle Data Set", buttonGroupStyle))
		{
			Debug.Log("Toggle data set");
			ObjectTracker objTracker = (ObjectTracker)TrackerManager.Instance.GetTracker( /* public abstract T GetTracker <T>() */ );

			// Toggle between first two available data sets.
			if (objTracker.GetNumDataSets() >= 2)
			{
				DataSet activeDataSet = objTracker.GetActiveDataSet();
				if (activeDataSet == objTracker.GetDataSet(0))
				{
					objTracker.DeactivateDataSet(activeDataSet);
					objTracker.ActivateDataSet(objTracker.GetDataSet(1));
					Debug.Log("swapping to dataset " + objTracker.GetDataSet(1).Path);
				}
				else
				{
					objTracker.DeactivateDataSet(activeDataSet);
					objTracker.ActivateDataSet(objTracker.GetDataSet(0));
					Debug.Log("swapping to dataset " + objTracker.GetDataSet(0).Path);
				}
			}

 

Controlling camera focus in Unity plugin

May 5, 2015 - 2:33am #34

mivan wrote:

Make sure you include this at the top of your script:

using Vuforia;

then you can just control the focus by doing:

CameraDevice.Instance.SetFocusMode (CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);

Which script? Anyone with the start() is good?

Controlling camera focus in Unity plugin

May 5, 2015 - 2:19am #33

Make sure you include this at the top of your script:

using Vuforia;

then you can just control the focus by doing:

CameraDevice.Instance.SetFocusMode (CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);

Controlling camera focus in Unity plugin

January 26, 2015 - 12:40pm #32

I have the same question.

I can't find the file "CameraDeviceMode.cs".

Controlling camera focus in Unity plugin

September 29, 2014 - 12:14pm #31

Where to find such CameraDeviceMode.cs? Please step by step if its somewhere inside inside. Where to copy autofocus code?

Controlling camera focus in Unity plugin

July 24, 2014 - 8:13am #30

Hello Everyone !

Sorry, I'm new on this, so does any one could explain me where does I have to add the camera autofocus line ?

I don't have any CameraDeviceMenu.cs file in my project.

Thanks !

Andrew/-

Controlling camera focus in Unity plugin

April 4, 2014 - 11:52am #29

All information on focus modes (what they meand and how to enable them) here:

https://developer.vuforia.com/resources/dev-guide/continuous-autofocus-and-other-focus-modes

 

Controlling camera focus in Unity plugin

April 4, 2014 - 11:35am #28

Hello!

 

How can I find out which focus modes are supported on the running device?

Also: What exactly does the focus mode "Normal" do?

 

Thanks in advance!

 

 

 

Controlling camera focus in Unity plugin

February 11, 2014 - 3:16am #27

I have these errors, what i must to do to solve these errors?

 

Rather than dump out the error stream on an existing thread while providing absolutely no other information....

... may I suggest creating a new thread where you clearly describe the problem, SDK version, platform, unity version etc.

 

Note, also, that we only support the latest SDK and samples, so please ensure that your error is reproduceable on this and provide exact steps to reproduce.

 

thanks

 

N

Controlling camera focus in Unity plugin

February 11, 2014 - 2:13am #26
I have these errors, what i must to do to solve these errors?
 
Assets/My Scripts/CameraDeviceMenu.cs(164,110): error CS0117: `Tracker' does not contain a definition for `Type'
Assets/My Scripts/CameraDeviceMenu.cs(164,91): error CS1501: No overload for method `GetTracker' takes `1' arguments
Assets/My Scripts/CameraDeviceMenu.cs(167,42): error CS1061: Type `ImageTracker' does not contain a definition for `GetNumDataSets' and no extension method `GetNumDataSets' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(169,70): error CS1061: Type `ImageTracker' does not contain a definition for `GetActiveDataSet' and no extension method `GetActiveDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(170,67): error CS1061: Type `ImageTracker' does not contain a definition for `GetDataSet' and no extension method `GetDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(173,83): error CS1061: Type `ImageTracker' does not contain a definition for `GetDataSet' and no extension method `GetDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(173,54): error CS1502: The best overloaded method match for `ImageTracker.ActivateDataSet(DataSet)' has some invalid arguments
Assets/My Scripts/CameraDeviceMenu.cs(173,54): error CS1503: Argument `#1' cannot convert `object' expression to type `DataSet'
Assets/My Scripts/CameraDeviceMenu.cs(174,89): error CS1061: Type `ImageTracker' does not contain a definition for `GetDataSet' and no extension method `GetDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(179,83): error CS1061: Type `ImageTracker' does not contain a definition for `GetDataSet' and no extension method `GetDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
Assets/My Scripts/CameraDeviceMenu.cs(179,54): error CS1502: The best overloaded method match for `ImageTracker.ActivateDataSet(DataSet)' has some invalid arguments
Assets/My Scripts/CameraDeviceMenu.cs(179,54): error CS1503: Argument `#1' cannot convert `object' expression to type `DataSet'
Assets/My Scripts/CameraDeviceMenu.cs(180,89): error CS1061: Type `ImageTracker' does not contain a definition for `GetDataSet' and no extension method `GetDataSet' of type `ImageTracker' could be found (are you missing a using directive or an assembly reference?)
 

 

Controlling camera focus in Unity plugin

November 20, 2013 - 2:27pm #25

I got this to work. but how would i make a virtual button to activate this instead of using a touch of the screen?

Controlling camera focus in Unity plugin

November 20, 2013 - 1:22pm #24

I keep getting this

CameraDeviceMode.cs(2,10): error CS8025: Parsing error

 

Controlling camera focus in Unity plugin

November 19, 2013 - 11:53am #23

Thanks for the quick reply. Does this work with vuforia 2.0 and do I need to create that script? I think I tried all this and there was errors about image tracker I think.

Controlling camera focus in Unity plugin

November 19, 2013 - 11:45am #22

You can simply copy that code to a file named CameraDeviceMode.cs, add it to your Assets folder and then drag the script onto your ARCamera for it to work.

Controlling camera focus in Unity plugin

November 19, 2013 - 11:42am #21

I am sorry for the basic question but how do I use this? I can't find a tutorial.

Controlling camera focus in Unity plugin

April 29, 2013 - 9:31am #20

Here is a script that demonstrates setting the focus mode..

 

e.g.

 

            if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO))
                mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO;

 

 

/*==============================================================================
            Copyright (c) 2012 QUALCOMM Austria Research Center GmbH.
            All Rights Reserved.
            Qualcomm Confidential and Proprietary
==============================================================================*/

using UnityEngine;
using System.Collections;
using System;

public class CameraDeviceMenu : MonoBehaviour
{
    #region NESTED

    // Defines which menu to show.
    private enum MenuMode
    {
        MENU_OFF,            // Do not show a menu (default).
        MENU_CAMERA_OPTIONS, // Show camera device options.
        MENU_FOCUS_MODES     // Show focus mode menu.
    }

    #endregion // NESTED



    #region PRIVATE_MEMBER_VARIABLES

    // Currently active menu.
    private MenuMode mMenuToShow = MenuMode.MENU_OFF;
    
    // Check if a menu button has been pressed.
    private bool mButtonPressed = false;
    
    // Check if flash is currently enabled.
    private bool mFlashEnabled = false;
    
    // Contains the currently set auto focus mode.
    private CameraDevice.FocusMode mFocusMode =
        CameraDevice.FocusMode.FOCUS_MODE_NORMAL;
    
    // Contains the rectangle for the camera options menu.
    private Rect mAreaRect;

    #endregion // PRIVATE_MEMBER_VARIABLES



    #region UNTIY_MONOBEHAVIOUR_METHODS

    public void Start()
    {
        // Setup position and size of the camera menu.
        computePosition();
    }


    public void OnApplicationPause(bool pause)
    {
        // Upon resuming reactivate the torch if it was active before pausing:
        if (!pause)
        {
            if (mFlashEnabled)
            {
                mFlashEnabled = CameraDevice.Instance.SetFlashTorchMode(true);
            }
        }
    }    

    
    public void Update()
    {
        // If the touch event results from a button press it is ignored.
        if (!mButtonPressed)
        {
            // If finger is removed from screen.
            if (Input.GetMouseButtonUp(0))
            {
                // If menu is not rendered.
                if (mMenuToShow == MenuMode.MENU_OFF)
                {
                    // Show menu.
                    mMenuToShow = MenuMode.MENU_CAMERA_OPTIONS;
                }
                // If menu is already open.
                else
                {
                    // Close menu
                    mMenuToShow = MenuMode.MENU_OFF;
                }
            }
        }
        else
        {
            mButtonPressed = false;
        }
    }


    // Draw menus.
    public void OnGUI()
    {
        switch (mMenuToShow)
        {
            case MenuMode.MENU_CAMERA_OPTIONS:
                DrawMenu();
                break;

            case MenuMode.MENU_FOCUS_MODES:
                DrawFocusModes();
                break;

            default:
                break;
        }
    }

    #endregion // UNTIY_MONOBEHAVIOUR_METHODS



    #region PRIVATE_METHODS

    // Draw menu to control camera device.
    private void DrawMenu()
    {
        computePosition();

        // Setup style for buttons.
        GUIStyle buttonGroupStyle = new GUIStyle(GUI.skin.button);
        buttonGroupStyle.stretchWidth = true;
        buttonGroupStyle.stretchHeight = true;

        GUILayout.BeginArea(mAreaRect);
        
        GUILayout.BeginVertical(buttonGroupStyle);

        GUILayout.BeginHorizontal(buttonGroupStyle);

        // Turn flash on or off.
        if (GUILayout.Button("Toggle Flash", buttonGroupStyle))
        {
            if (!mFlashEnabled)
            {
                // Turn on flash if it is currently disabled.
                CameraDevice.Instance.SetFlashTorchMode(true);
                mFlashEnabled = true;
            }
            else
            {
                // Turn off flash if it is currently enabled.
                CameraDevice.Instance.SetFlashTorchMode(false);
                mFlashEnabled = false;
            }

            mMenuToShow = MenuMode.MENU_OFF;
            mButtonPressed = true;
        }
        
        // Swap data sets.
        if (GUILayout.Button("Toggle Data Set", buttonGroupStyle))
        {
            Debug.Log("Toggle data set");
            ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);

            // Toggle between first two available data sets.
            if (imageTracker.GetNumDataSets() >= 2)
            {
                DataSet activeDataSet = imageTracker.GetActiveDataSet();
                if (activeDataSet == imageTracker.GetDataSet(0))
                {
                    imageTracker.DeactivateDataSet(activeDataSet);
                    imageTracker.ActivateDataSet(imageTracker.GetDataSet(1));
                    Debug.Log("swapping to dataset " + imageTracker.GetDataSet(1).Path);
                }
                else
                {
                    imageTracker.DeactivateDataSet(activeDataSet);
                    imageTracker.ActivateDataSet(imageTracker.GetDataSet(0));
                    Debug.Log("swapping to dataset " + imageTracker.GetDataSet(0).Path);
                }
            }
            else
            {
                Debug.LogWarning("Not enough data sets to toggle");
            }
        }
        
        GUILayout.EndHorizontal();
        
        GUILayout.BeginHorizontal(buttonGroupStyle);

        // Triggers auto focus:
        if (GUILayout.Button("Trigger Autofocus", buttonGroupStyle))
        {
            if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO))
                mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO;

            mMenuToShow = MenuMode.MENU_OFF;
            mButtonPressed = true;
        }

        // Choose focus mode.
        if (GUILayout.Button("Focus Modes", buttonGroupStyle))
        {
            mMenuToShow = MenuMode.MENU_FOCUS_MODES;
            mButtonPressed = true;
        }

        GUILayout.EndHorizontal();
        
        GUILayout.EndVertical();

        GUILayout.EndArea();
    }


    // Draw menu to let user choose a focus mode.
    private void DrawFocusModes()
    {
        CameraDevice.FocusMode newMode;
        newMode = EnumOptionList(mFocusMode);

        // We set the new value only if the mode has changed.
        if (newMode != mFocusMode)
        {
            if (CameraDevice.Instance.SetFocusMode(newMode))
                mFocusMode = newMode;

            mMenuToShow = MenuMode.MENU_OFF;
            mButtonPressed = true;
        }
    }


    // Helper function to automatically create an option list of an enum object.
    private static CameraDevice.FocusMode EnumOptionList(
                                    CameraDevice.FocusMode setMode)
    {
        Type modeType = setMode.GetType();

        // Get possible enum values.
        CameraDevice.FocusMode[] modes =
            (CameraDevice.FocusMode[])Enum.GetValues(modeType);

        // Setup style for list.
        GUIStyle optionListStyle = new GUIStyle(GUI.skin.button);
        optionListStyle.stretchHeight = true;
        optionListStyle.stretchWidth = true;

        // Setup style for toggles.
        // We use "button" style as template because default toggles are too
        // small.
        GUIStyle toggleStyle = new GUIStyle(GUI.skin.button);
        toggleStyle.stretchHeight = true;
        toggleStyle.stretchWidth = true;
        toggleStyle.normal.textColor = Color.gray;
        toggleStyle.onNormal.textColor = Color.gray;
        toggleStyle.focused.textColor = Color.gray;
        toggleStyle.onFocused.textColor = Color.gray;
        toggleStyle.active.textColor = Color.gray;
        toggleStyle.onActive.textColor = Color.gray;
        toggleStyle.hover.textColor = Color.gray;
        toggleStyle.onHover.textColor = Color.gray;

        // Setup style for active toggle.
        // Setting active values for the toggle Style does not work so we create
        // another style.
        GUIStyle activeToggleStyle = new GUIStyle(toggleStyle);
        activeToggleStyle.normal.textColor = Color.white;
        activeToggleStyle.onNormal.textColor = Color.white;
        activeToggleStyle.focused.textColor = Color.white;
        activeToggleStyle.onFocused.textColor = Color.white;
        activeToggleStyle.active.textColor = Color.white;
        activeToggleStyle.onActive.textColor = Color.white;
        activeToggleStyle.hover.textColor = Color.white;
        activeToggleStyle.onHover.textColor = Color.white;


        CameraDevice.FocusMode newMode = setMode;

        // We render the menu over the full screen.
        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));

        GUILayout.BeginVertical();

        foreach (CameraDevice.FocusMode mode in modes)
        {
            if (mode == setMode)
            {
                GUILayout.Toggle(true, mode.ToString(), activeToggleStyle);
            }
            else
            {
                if (GUILayout.Toggle(false, mode.ToString(), toggleStyle))
                {
                    newMode = mode;
                }
            }
        }

        GUILayout.EndVertical();

        GUILayout.EndArea();

        return newMode;
    }


    /// Compute the coordinates of the menu depending on the current orientation.
    private void computePosition()
    {
        int areaWidth = Screen.width;
        int areaHeight = (Screen.height / 5) * 2;
        int areaLeft = 0;
        int areaTop = Screen.height - areaHeight;
        mAreaRect = new Rect(areaLeft, areaTop, areaWidth, areaHeight);
    }

    #endregion // PRIVATE_METHODS
}

 

Controlling camera focus in Unity plugin

April 29, 2013 - 8:31am #19

looks like api has changed slightly what is now the best way to control camera focus or enable continuuos autofocus

Re: Controlling camera focus in Unity plugin

March 20, 2012 - 9:39am #18

I've just tested the download and it's fine. Try w/ FireFox or Chrome.

Re: Controlling camera focus in Unity plugin

March 20, 2012 - 9:26am #17

Hi!

I tried downloading the extension from this page:

https://ar.qualcomm.at/qdevnet/sdk

but it doesn't work - it's downloading for hours and nothing happens. Download it via AssetStore works, but there is no MenuScript :confused:

BUT i attached Davids Script -> TATA worx, thank you :)

Re: Controlling camera focus in Unity plugin

March 19, 2012 - 6:47pm #16

I suggest downloading the final 1.5 release (it sounds like you still have the beta). The CameraDeviceMenu.cs script should be in the Scripts folder of any of the sample applications. Note the script David attached depends on 1.5 final.

- Kim

Re: Controlling camera focus in Unity plugin

March 19, 2012 - 3:13am #15
DavidBeard wrote:

If your installation doesn't have the CameraDeviceMenu.cs script, you can use the one I've attached. Be sure to change the file extension so that the file is named CameraDeviceMenu.cs

Thank you!

But using the CameraDeviceMenu script, i got following error massage:

CameraDeviceMenu.cs ( 40,32 ): error CS0117 : CameraDevice.FocuseMode doesn't contain a definition for "FOCUS_MODE_NORMAL"

Re: Controlling camera focus in Unity plugin

March 17, 2012 - 10:15am #14

If your installation doesn't have the CameraDeviceMenu.cs script, you can use the one I've attached. Be sure to change the file extension so that the file is named CameraDeviceMenu.cs

Re: Controlling camera focus in Unity plugin

March 17, 2012 - 9:07am #13

Does this work on iOS 5 as well where a user touches a particular area of the camera to focus to?

Re: Controlling camera focus in Unity plugin

March 16, 2012 - 9:55am #12

No there is no Script like this :(
i'm using Beta 1.5.4 - as i said in version 1.0.6 there was a CameraDeviceMenu Script. But when trying to use this, i got error massages.

Re: Controlling camera focus in Unity plugin

March 16, 2012 - 7:31am #11

There should be a version in the Scripts folder of the ImageTargets sample.

Re: Controlling camera focus in Unity plugin

March 16, 2012 - 6:10am #10
ksiva wrote:

The menu is just meant to provide sample code, I suggest turning it off when you start writing your own application. It's the CameraDeviceMenu script attached to the ARCamera. The line of code you want is this:

this.GetComponent<CameraDeviceBehaviour>().StartAutoFocus();

That will work from any script attached to the ARCamera.

- Kim

Hi!

I'm using the 1.5 beta ( still ) - is there a chance for none-coders to access the focus menu like it was in version 1.0.6 ? The CameraDeviceMenu.cs from the 1.0.6 version won't work with 1.5.
And in the new vuforia-version i can't find the CameraDeviceMenu - the imageTarget Folder is empty

Re: Controlling camera focus in Unity plugin

February 27, 2012 - 7:49am #9

Thank You Kim :)

I used old Unity trick, start function in C# from Javacript using SendMessage :)

Re: Controlling camera focus in Unity plugin

February 17, 2012 - 10:08am #8

Mixing Javascript and C# is a bit tricky. If the Javascript depends on C# classes, then you need to ensure that the C# classes are compiled first. You can do this by putting them in a folder that is compiled in an earlier pass, e.g. the Plugins folder. Try dragging the entire Qualcomm Augmented Reality folder into the Plugins folder, and leave your Javascript outside of this folder. That should fix the issue.

See more on Unity script compilation order here: http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html

- Kim

Re: Controlling camera focus in Unity plugin

February 16, 2012 - 12:02am #7

Hello :)

How can I use it in javascript?
I need to turn on AutoFocus and have acces to Flash

in c# it's:

CameraDevice.Instance.SetFlashTorchMode(true)

in javascript I wanna use code like this:

function OnGUI() {

    if (GUI.Button(Rect(Menu.x,Menu.y,Menu.z,Menu.w),"Flash"))
    {
        ... do something, but how?
    }

}

Re: Controlling camera focus in Unity plugin

December 30, 2011 - 2:53pm #6

It's even easier with 1.5. CameraDevice is now a singleton, so you can call this from anywhere:

CameraDevice.Instance.StartAutoFocus();

- Kim

Re: Controlling camera focus in Unity plugin

December 30, 2011 - 12:39pm #5

Since CameraDevice is no longer a MonoBehaviour, this method no longer works. Could anyone suggest an update?

Re: Controlling camera focus in Unity plugin

May 20, 2011 - 10:52am #4

The menu is just meant to provide sample code, I suggest turning it off when you start writing your own application. It's the CameraDeviceMenu script attached to the ARCamera. The line of code you want is this:

this.GetComponent<CameraDeviceBehaviour>().StartAutoFocus();

That will work from any script attached to the ARCamera.

- Kim

Re: Controlling camera focus in Unity plugin

May 20, 2011 - 5:03am #3

The menu is great, but if i want to use the functionality of the screen (interaction with the content) won't i run into the menu the entire time ?

Isn't there a way to modify the script so the autofocus is always on ? I'm not really a die hard programmer, so i don't think i can figure it out on my own :(

Re: Controlling camera focus in Unity plugin

May 17, 2011 - 6:17am #2

Just what i needed, Thanks :D

Log in or register to post comments