Log in or register to post comments

Question - User defined target with unity3d

January 6, 2014 - 12:19pm #1

Hi to all members

I'm trying to solve a problem.
can I use "user defined target" as 3d texture of an object in Unity3D?
I need that when I create a target using the package "userdefinedtargets", the image must be the texture of a 3d object.
I wrote this little js code that only works if the target is fixed and not dynamic.
 
var gid : GameObject;
renderer.materials = gid.renderer.materials;

 

 
thank you very much.

Question - User defined target with unity3d

January 7, 2014 - 6:47am #6
I can ask only which is the file to create the UDT
I understand that this file "UserDefinedTargetEventHandler" used for create UIbutton and target dataset. But I don't understand which is the function or file for create UDT. 
I know c# little bit and I lost two day for this problem.

Question - User defined target with unity3d

January 6, 2014 - 1:29pm #5

This is up to you; a common choice is to apply the script to the ARCamera object, but you may also want to attach the script directly to the 3D object to which you want to apply the texture to. It depends pretty much on your preferences and design needs.

 

Question - User defined target with unity3d

January 6, 2014 - 12:58pm #4
Thanks for the replies,
I take this opportunity to ask then:
what is the object I apply the script?

Question - User defined target with unity3d

January 6, 2014 - 12:43pm #3

Hi Andrea,

Vuforia does not offer an explicit API to capture the UDT image (and use it as a texture that you can wrap around a generic 3D object);

however, a simple trick could be to capture the camera image at the same time when you build the UDT (so that the UDT is built from that same camera frame image);  once you have grabbed the camera frame in an image, you can then use the image to build a texture and set the texture in the material of the object.

On how to capture the camera image, see:

https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access

How to build a Texture and set it in the material, see the Unity developer guide (as this is not specific to Vuforia).

Also, note that you will need to have texture coordinates in the mesh of your 3D object, to be able to wrap the texture around its surface.

Hope this helps.

 

Question - User defined target with unity3d

January 6, 2014 - 12:30pm #2

You should be able to do the same with UDTs. Where is that script enabled, and when?

The UDT actually uses a clone of the IT template that you provide - so perhaps you aren't referencing the correct instance?

Log in or register to post comments