Changing FocusType of Camera in Script

0 votes
asked Oct 17, 2018 by seba0604 (140 points)

Hello,

i'm new into working with Unity 3D and easyAR.

My Coding-Skills are very low, so i can't write a script on my own....

Im working on a VR-App for PC with Unity 3D and easyAR.

So far i was able to Import easyAR into my Unity 3D Project and could also integrate it in my Scene.

So the Tracking and appearing of Objects is working fine.

Finally I want to adjust the Focus Type of my WebCam, but i have no idea, how the script would look like, and where (or on which object) i have to add the script in my Scene?!?!

Can anyone help?

Thanks in Advance.

Seba

3 Answers

0 votes
answered Oct 17, 2018 by albert52 (31,850 points)
commented Oct 18, 2018 by seba0604 (140 points)
Thank your for answering my question!
I saw it in the Documentation, but i got no idea how to use it...

I started trying to write a script, but i get an error in Unity:

Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EasyAR;

public class FocusController : MonoBehaviour {

    enum FocusMode{Normal, Triggerauto, Continousauto, Infinity, Macro}
    // Use this for initialization
    void Start () {
       
        bool Open(Device camera = Device.Default)
        bool Start()
        bool SetFocusMode(FocusMode Macro)
       
    }
   
    // Update is called once per frame
    void Update () {
       
    }
}

Error in Unity:
Assets/Scripts/FocusController.cs(12,11): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='

What am i doing wrong?
And would it work?!

Thanks in Advance.
Seba
0 votes
answered Nov 22, 2018 by ouzari (210 points)
using UnityEngine;
using System.Collections;
using EasyAR;
namespace EasyAR
{
    public class AutoFocusScript : MonoBehaviour
    {
       
        void Start()
        {
            ARBuilder.Instance.CameraDeviceBehaviours[0].SetFocusMode(CameraDeviceBaseBehaviour.FocusMode.Continousauto);

        }   
        
    }
}
0 votes
answered Jul 29, 2019 by cleitoncmachado (620 points)
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...