I am building an app where I will have four targets. Each target will have a separate animation but it will be of the same character. Is there a way to do this where I don't have to duplicate the same character for each target? I am trying to Limit the size Of the app.
Using the same object for multiple targets
Yes you can assign the model to the target programmatically by defining the model's transform.parent as the transform of the ImageTarget object. This will make the model a child of that target in the same way you do by dragging it onto the target in the Editor.
e.g. in the DefaultTrackableEventHandler OnTrackingFound()
ModelObject.transform.parent = this.gameObject.transform;
It may be helpful to first make your model the child of a GameObject (e.g. ModelObject ) and to reference that object when assigning the parent targets. This will make the scale of the 3D model independent of the local scale of the target, which makes it easier to use the same model for multiple targets.
If you need to position the model on the targets, use the .position and .rotation properties - http://docs.unity3d.com/Documentation/ScriptReference/Transform.html
Are you sure you want to delete this message?
Are you sure you want to delete this conversation?