Log in or register to post comments

Simple Question.

April 7, 2012 - 8:48pm #1

Hello there,

It is possible to swap or change objects or assets in runtime if they havent been previously loaded?

lets see this scenario:

i have an object, lets say a cube, when i start the app the cube is binded to an trackable image. ok

now, when the app starts, it connects to a server and download new objects, lets say a sphere.

now, its possible to remove the cube and put the sphere? in order that, when i scan the image the cube no longer appears, but the sphere?

i've been trying like for hours and i cant get it done.. i do everything but even when i replace the cube with the sphere, it seems like the cube stays in some temporal memory because every single time i scan the trackable image, its the cube what i get, even when is not active any longer.

any thoughts?

thank you!

Re: Simple Question.

April 11, 2012 - 8:48pm #5

hehe my bad, im sorry.. i forgot to mention i was using Unity3D

ok im going to try right away, in fact i think the sphere is being instanced far away from the trackable image, i didn't thought it was important.

Thank you again!

i'll let you know how it goes.
-Brian.

Re: Simple Question.

April 10, 2012 - 3:39pm #4

Ah, you didn't mention this is using Unity. If it's posted in the Android forum we'll assume native Android unless stated otherwise.

Adding the object as a child of the ImageTarget should be enough, are you scaling it to match the scale of the target? Also make sure you are aligning it with the target, you may need to set the localPosition after setting the model's parent to the target.

I suggest testing this with a simple cube primitive first:

http://unity3d.com/support/documentation/ScriptReference/GameObject.CreatePrimitive.html

- Kim

Re: Simple Question.

April 10, 2012 - 6:46am #3

Hello ksiva, thank you for your answer.

I don't use Eclipse, however i think i can get the log you mention from the DDMS tool from the Android SDK ToolKit.

The thing that leave me a little lost is the part where you said i should have to be swapping out the vertices, texcoords, etc.

Do you mean i have to maintain the asset name within the parent imageTarget and just replace the object?

let me explain what im doing ( you can see the attach image )

im moving the current object (box) from the imageTarget and putting it somewhere else and then i move an object ( instance object - downloaded from asset bundle ) and im putting it as a child of the imageTarget.

i thought that by making an object child of an imageTarget would be enough just to make it work, but seems like its not.

Thanks again and best regards!
-Brian.

Re: Simple Question.

April 9, 2012 - 7:51am #2

You should be swapping out the vertices, texcoords, etc. in the native code. Try adding some log lines to confirm that your changes are taking effect. You can see the log using the DDMS perspective in Eclipse.

- Kim

Log in or register to post comments