Author Topic: Vuforia / jpct / load 3D Model  (Read 3280 times)

Offline Bin

  • byte
  • *
  • Posts: 8
    • View Profile
Vuforia / jpct / load 3D Model
« 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

Offline Maro

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Vuforia / jpct / load 3D Model
« Reply #1 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!

Offline Bin

  • byte
  • *
  • Posts: 8
    • View Profile
Re: Vuforia / jpct / load 3D Model
« Reply #2 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Vuforia / jpct / load 3D Model
« Reply #3 on: April 28, 2013, 11:04:39 pm »
Are you actually calling animate(...) on it?

Offline Bin

  • byte
  • *
  • Posts: 8
    • View Profile
Re: Vuforia / jpct / load 3D Model
« Reply #4 on: April 29, 2013, 08:14:24 am »
Hi,

no i didn`t.

Do you have a Sample how to do that?


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Vuforia / jpct / load 3D Model
« Reply #5 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.