Log in or register to post comments

someone help me to program pleasee!!

June 3, 2012 - 1:06pm #1

Hi I am new to this world, and not programming, I wonder if anyone can help me to do 3 things ..

as I can put a script to the ARcamera to focus when you touch the screen?

as I can put another script to the ARcamera to put a button on the right corner (like an X) to close the application?

I can do is install the application on the SD memory? I have the option of "prefer external" but not yet installed in the SD ..

please someone help me! would be very grateful

Re: someone help me to program pleasee!!

June 4, 2012 - 1:32pm #3

Don't use RaycastHit hit = new RaycastHit(); when capturing the touch - that's from code I'd copied for the example.

Re: someone help me to program pleasee!!

June 4, 2012 - 12:59pm #2

See the CameraDeviceMenu.cs script which comes with the samples for examples of how to access the camera and also draw GUI elements on screen.

To trigger a focus operation use ...
CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO);

To close the application use ...
Application.Quit();

e.g.

OnGUI(){

  if( GUILayout.Button("exit") )
      Application.Quit();
}

To catch touch events you can try ..

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class OnTouchDown : MonoBehaviour
{
    void Update () {
        
        RaycastHit hit = new RaycastHit();
        for (int i = 0; i < Input.touchCount; ++i) {
            if (Input.GetTouch(i).phase.Equals(TouchPhase.Began)) {
              CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO);

           }
       }
    }
}

To install on SD memory, add the installLocation attribute to your Android Manifest.

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.qualcomm.QCARUnityPlayer"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="auto" 
    >

You can find AndroidManifest.xml in /Plugins/Android in your Unity Project panel. This will give you the option to transfer the APK to external storage.

Log in or register to post comments