www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Bin on April 24, 2013, 08:00:50 am

Title: Vuforia / jpct / load 3D Model
Post by: Bin on April 24, 2013, 08:00:50 am
Hi,

after i integrated Vuforia with jpct i saw the cube on my target.

ok.

But now i want to change the cube with my own model. how can i do that?



thanks
Title: Re: Vuforia / jpct / load 3D Model
Post by: Maro on April 24, 2013, 11:08:17 am
Assuming you want to load on obj model you need to:
1 create an array of object3d
2 load that obj into an input stream
3 load the mtl in another input stream
4 inizialize array with the right function

an example of code here:
Code: [Select]
public Object3D[] model;
public AssetManager mngr;
public InputStream objStream = null;
public InputStream mtlStream = null;

//into your constructor
public yourconstructor()
{
.
.
.
mngr = instanceofactivity.getAssets();
try {
objStream = mngr.open("file.obj");
} catch (IOException e) {
e.printStackTrace();
}
try {
mtlStream = mngr.open("file.mtl");
} catch (IOException e) {
e.printStackTrace();
}
   
model = Loader.loadOBJ(objStream, mtlStream, x);
.
.
.
}
In this case i put my file into the assets folder.
Hope can be helpful!
Title: Re: Vuforia / jpct / load 3D Model
Post by: Bin on April 28, 2013, 08:07:40 pm
Great!

It works.

But now i tried to export the md2 File from Blender with an KeyFrame animation,
and put the new md2File in the assetsFolder.

After exporting it as an App, it just shows me that 3D model without animation.

Do you know how it works?
Title: Re: Vuforia / jpct / load 3D Model
Post by: EgonOlsen on April 28, 2013, 11:04:39 pm
Are you actually calling animate(...) on it?
Title: Re: Vuforia / jpct / load 3D Model
Post by: Bin on April 29, 2013, 08:14:24 am
Hi,

no i didn`t.

Do you have a Sample how to do that?

Title: Re: Vuforia / jpct / load 3D Model
Post by: EgonOlsen on April 29, 2013, 12:26:24 pm
The advanced example in the wiki has animations (it's for desktop jPCT, but that doesn't really matter in this context) and the sources of Alien Runner use animations as well.