www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started 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
-
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:
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!
-
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?
-
Are you actually calling animate(...) on it?
-
Hi,
no i didn`t.
Do you have a Sample how to do that?
-
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.