By Jaguar
on Thu, 04/25/2013 - 08:17
Hi, I have created an Android app using Unity 3D, following this tutorial.
I want to know is there any way to add multiple 3D models in the app and display only a selected one on ImageTarget, and also be able to change 3D model at runtime?
Does unity allow this?
Please Reply...
Select 3D Model at runtime from multiple models on one ImageTarg
Hi,
yes, this is possible; 3D models can be attached as children of the ImageTarget in the scene view, or dynamically via script code; you can also then enabled/disable objects so to show only a selelected one and hide the others.
Select 3D Model at runtime from multiple models on one ImageTarg
Can you please explain how multiple 3D models be attached as children of the ImageTarget in the scene view?
Thanks in advance...
Select 3D Model at runtime from multiple models on one ImageTarg
That would be just a matter of dragging the models (prefabs) from the project view into the image target node in the hierarchical scene view.
Select 3D Model at runtime from multiple models on one ImageTarg
What you have said it will only allow me to select a model at compile or coding time and what I want is to be able to select among different models at run time in android. I have added two models on ImageTarget in Hierrchy View and they appear in android app as shown in the attached image.
Select 3D Model at runtime from multiple models on one ImageTarg
Hi, the best is then (at runtime, i.e. via script) to only enable the rendering of one of those models, and disabling all the others;
this is simpler than attaching / detaching objects to/from the scenegraph at runtime (although that's also a viable technique).
Select 3D Model at runtime from multiple models on one ImageTarg
When I set
Select 3D Model at runtime from multiple models on one ImageTarg
Hi, this is due to the GetComponentsInChildren, which actually returns all the renderers for all the objects that are attached under the Target.
You need to adapt that sample code snippet to only take the renderer of a specific gameObject.
Select 3D Model at runtime from multiple models on one ImageTarg
Hi,
I am able to select one model among different by modifying the DefaultTrackableEventHandler like this.
Select 3D Model at runtime from multiple models on one ImageTarg
Hi, I'm not aware of a way of directlty accessing and modifying C# script variables from Java (Android),
however, if you want to be sure, this is a question you may want to verify directly on the Unity website.