Log in or register to post comments

Android animation

July 11, 2011 - 1:53am #1

Hi,

On my previous app using QCAR (without Unity), I modified the code so that the texture of the object changes when the screen is touched by the user.

Generally, is it possible to modify the code when using the Unity extension, to make some animation with Android (add a button, or a touchEvent for instance) ?

For example, I would like to see an image illustrating my app before the app starts.
And I would like to change the 3D objects when I touch the screen.

Re: Android animation

July 19, 2011 - 8:55pm #9

for this as well as a discussion here in the QCAR forums at http://ar.qualcomm.at/node/2000478

Thank you,

-Peter

Re: Android animation

July 19, 2011 - 2:02am #8

Thank you!

About importing a Unity project in Eclipse, do you think it does worth it to do it?

Re: Android animation

July 15, 2011 - 11:24am #7

Hello ACT,

There are three types of scripts included in the QCAR Extension.

The scripts in the Editor/QCAR/Scripts folder are scripts used by the editor to automate simple processes like how an config.xml updates when changes are made to an Imagetarget in the scene window.

The scripts in the Qualcomm Augmented Reality/Scripts folder are there for you to implement in your own scripts.

The scripts in the Scripts folder are sample implementations. For example there is a sample TrackableEventBehavior script in the ImageTargets project that implements the ITrackableEventHandler interface from the Qualcomm Augmented Reality/Scripts folder.

You can write scripts in Javascript and C#. Please see the Unity3D website for more info on doing this.

It is possible to integrate you unity generated files with Eclipse. There is a discussion here in the forums and documentation on the Unity3D website for doing this. http://unity3d.com/support/documentation/Manual/Android-Integrating%20Unity%20With%20Eclipse.html

Thank you,

-Peter

Re: Android animation

July 14, 2011 - 6:04am #6

Well, I will have some other questions...

1) I don't understand well how the project is structured...
Why in your samples are there three different folders for the Scripts?
- in Editor/QCAR/Scripts
- in Qualcomm Augmented reality / Scripts
- in Scripts
Because there is a difference between these script?

2) Is it possible to write some scripts with C#, and some others with JavaScript, in the same project/scene?

3) When I program a Unity app, is it possible for me to access to the genrated Java classes (if they are) to then import them in Eclipse?

Re: Android animation

July 14, 2011 - 2:57am #5

Than you so much!
I didn't know I could add scripts to a camera!

I'll make some try!

Re: Android animation

July 13, 2011 - 2:51pm #4

about registering touch events and http://ar.qualcomm.at/node/2000405 about swapping models.

It sounds like you want to swap textures instead of models. See the OnButtonPressed function of the VirtualButtonEventHandler.cs script in the VirtualButtons Unity sample application to see how you can swap materials on your object.

Thank you,

-Peter

Re: Android animation

July 12, 2011 - 4:30am #3

Pfff...

It is really not easy to start... :rolleyes:

With QCAR SDK on Eclipse, animations are written in a cpp function which is updated every frame.
However, in Unity, I don't understand where I have to write the program for every frame? Do I have to write one script? Several scripts?
Do I have to attach it to one object?
And what if I want to change the object by pressing the screen, meaning that a script must be sharing by at least two different objects...

In the QCAR project's structure, some scripts are already located in Editor/QCAR/scripts and in QualcommAugmentedReality/Scripts. Are they all used?
And when I created one, it is automatically placed in Editor/QCAR.

Finally, I read the Getting started page about Virtual buttons, and it is written, for instance, that:

Quote:

You can create a new Virtual Button for a given Image Target at run-time by calling the CreateVirtualButton member function on the corresponding instance of your ImageTargetBehaviour.

But where (again) do I call this funtion?

THEN, I would like to change the starting animation of the app, the one with Unity's logo. But I don't know where (and again...) it is located in the project...

EDIT:
Well, at the moment, I have 2 different objects (called A and B). They exactly have the same shape and are located on the same place on the target. They just differ from their texture/colors.
I created and attached one script per object:
-for A: A is first visible, and becomes invisible when the screen is pressed, then re-becomes visible when the screen is re-pressed, etc...
-for B: B is first invisible, and becomes visible when the screen is pressed, then re-becomes invisible when the screen is re-pressed, etc...
...so that -for A: when the screen is pressed, we have the impression that the texture of the object changes.

Does somebody have an easiest method?

Re: Android animation

July 11, 2011 - 12:13pm #2

Hello,

Unity 3D is a powerful game development tool. Adding buttons and registering touch events are supported. You can read more on their website at www.unity3d.com .

You can download a trial of Unity3d from their website. Then download the QCAR Extension from this website and start creating interactive AR applications.

A good starting point is the "Getting Started - Unity Extension" section of this website and the sample applications that are provided with the QCAR Extension. All QCAR sample apps register a touch event to bring up a menu. Also look at the Virtual Buttons sample app to see how to swap textures on a model. Instead of swapping the texture you can swap out the model.

Thank you,

-Peter

Log in or register to post comments