Log in or register to post comments

Running and Understanding Unity examples

December 8, 2012 - 9:22am #1

Hi,

I am a newbie to this world (vuforia and Unity). I downloaded the vuforia extension for Unity from qualcomm site. It contains different examples and essential scripts. I would like to know following things -

a) How to run examples in Unity. Currently what I do, is that I double click the package and find that there is nothing to play. So I have to basically drag drop camera, image target, virtual button etc...

Is this correct approach? or am I missing something?

b) If I have to do all that drag drop thing manually, where can I find instructions, how to link all those things. The documentation under unity extension, does not talk about that.

c) I tried to follow the instructions in this video, http://www.youtube.com/watch?v=EkIMyBQtLOw. It seems to work with funny results. The structure of the program is as follows -

ARCamera

ImageTarget

|-Steam

|-teapot

|-VirtualButton

Following are the problems observed --

i) When I point my device to the image on my laptop, the steam seems to come out by itself without the need for me to press virtual button.

ii) If I point my device to image on paper, the steam never comes out, which seems like virtual button press is never captured.

Here is the VirtualButtonEventHandler attached to the ImageTarget.

 

public class VirtualButtonEventHandler : MonoBehaviour,

                                         IVirtualButtonEventHandler

{

    private ParticleEmitter mSteamEmitter = null;

    void Start()

    {

        // Register with the virtual buttons TrackableBehaviour

        VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();

        for (int i = 0; i < vbs.Length; ++i)

        {

            vbs[i].RegisterEventHandler(this);

        }

        // Get handle to the teapot object

        mSteamEmitter = GetComponentInChildren<ParticleEmitter>();

if(mSteamEmitter)

mSteamEmitter.emit = false;

    }

    // Called when the virtual button has just been pressed:

    public void OnButtonPressed(VirtualButtonBehaviour vb)

    {

        Debug.Log("OnButtonPressed");

if(mSteamEmitter)

mSteamEmitter.emit = true;

    }

    // Called when the virtual button has just been released:

    public void OnButtonReleased(VirtualButtonBehaviour vb)

    {

        Debug.Log("OnButtonReleased");

    }

}

 

 

d) I was trying to emulate Interaction with Multiple Targets example given in this link http://www.youtube.com/watch?v=sBTFm14Eoz4. I was able to follow most of the part, but was stuck at two places -

  1. Where do I place the virtual Button, for starting steam when pot is placed on fire. (My guess was on fire itself).
  2. How to create mesh collider mentioned in the video. Is there some link which can help me understand what is mesh collider and how to create one myself.

Thanks

-Katch

Running and Understanding Unity examples

December 11, 2012 - 9:08am #3
  1. Where do I place the virtual Button, for starting steam when pot is placed on fire. (My guess was on fire itself).
  2. How to create mesh collider mentioned in the video. Is there some link which can help me understand what is mesh collider and how to create one myself.

 

Make the VB a child of the ImageTarget instance and position it in the scene view. Attach your VB event handler to the parent ImageTarget and customize this for the desired interactive behaviour. There's an example of a VB event handler in the VB sample.

The Mesh Collider can be added by selecting your object in the hierarchy and selecting Component > Physics > Mesh Collider from the Unity menu. 

Do you have the Unity samples? - they come with the extension package : https://ar.qualcomm.at/sdk

Running and Understanding Unity examples

December 10, 2012 - 6:38am #2

Hi katchdoze,

or am I missing something?

Yes :)

In each sample you should find a scene in the project hierarchy which you need to double click to make it the current scene.

Then you can follow the step by step instructions as provided here:

https://ar.qualcomm.at/sdk  Android/iOS -> Getting Started Unity Extension -> Step 2 : Compiling a Simple Project

HTH

N

 

 

Log in or register to post comments