Help with exporting Anim8or to Java
I am trying to make some simple models in Anim8or and then export them as .obj files to my Java game, more to prove to myself that I can do it than anything else. After much struggling with the ObjectFile class and the not-very-bright Loader interface, I finally got the model up in my game window. Unfortunately, it appeared to have some quite large holes in it, that is, many of the faces were apparently not drawn. I suspect this is caused by Anim8or exporting some faces in clockwise order, and some in anticlockwise; Java wants them anticlockwise. Is there a way to make Anim8or be consistent about this? Clockwise would be OK, the ObjectFile loader can deal with that; but I do need consistency.
To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
Although I'm not very familiar with anim8or, I'm nearly positive that you can not change many of the options that you may want to. Blender, however, is also free, and has the power of professional modeling packages. Try downloading Blender and see if you get better results.
Blender Download Page
Blender Download Page
I'll try that tomorrow; for now, I've fixed my original problem, but run into a new one. I can't figure out how to extract the materials property from the OBJ file. But I'm pretty spaced-out at the moment, I'm probably ignoring something obvious. Here's my code :
Which returns a non-null object, as attested by the output :
so all should be well, but when I add this to my game object, so :
I get nothing but blackness. I've managed to make the actual shape appear, in pure white; I'm rather confused as to why the material won't come out to play.
Perhaps, though, this belongs in the Java forum by now? Could some kind mod move it, please?
public static Appearance getAppearance (String fName) { int index = loadFile(fName); Scene curr = loadedShapes[index]; Enumeration theObjects = curr.getNamedObjects().elements(); // TODO : Oi, oi, oi, vey, this is incredibly fragile. Fix! Shape3D theShape = (Shape3D) theObjects.nextElement(); Appearance ret = theShape.getAppearance(); System.out.println(ret.toString()); System.out.println(ret.getMaterial().toString()); return theShape.getAppearance(); }
Which returns a non-null object, as attested by the output :
javax.media.j3d.Appearance@2bc3f5Material Object:AmbientColor=(0.4, 0.4, 0.4) EmissiveColor=(0.0, 0.0, 0.0) DiffuseColor=(0.7102, 0.702, 0.6531) SpecularColor=(0.3, 0.3, 0.3) Shininess=128.0 LightingEnable=true ColorTarget=2javax.media.j3d.Appearance@2bc3f5
so all should be well, but when I add this to my game object, so :
myShape.setAppearance(ShapeManager.getAppearance("flatship.obj"));
I get nothing but blackness. I've managed to make the actual shape appear, in pure white; I'm rather confused as to why the material won't come out to play.
Perhaps, though, this belongs in the Java forum by now? Could some kind mod move it, please?
To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement