www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: orange451 on May 09, 2012, 03:54:07 am
-
In a project I'm doing, I need to use the .setMesh() method on an Object3D object, and the paremeter passed into the .setMesh() is the mesh (.getMesh()) of another object3D object.
basically:
object2.setMesh(object1.getMesh());
However, when I applied a texture to object2, I found that object2's UV coords are all at 0,0 on the UV map.
Any ideas?
-
Yes. That's because uv-mapping is part of the Object3D, not of the Mesh. If you want to clone these, you should rather do something like
Object3D clone=new Object3D(bluePrint, true);
-
the only problem, which I probably should have mentioned, is that I created a new class, called Model. Model extends Object3D. Using the way you just provided wont work, because you can't cast the Object3D class D:
-
I fail to see the problem. You could simply use that constructor in the constructor of Model. I'm always doing it that way.
-
Then everytime I create the Model object, I need to reload the model, rather than just copy it from the already existing model.
-
No, you don't. I don't really get the problem...You can load the model once, store it somewhere and then do something like
public class Model {
public Model() {
super(<your model blueprint comes here>, true);
....
}
}