Hello
I’m trying to load a model exported from blender (HottBj), attach some physic to it (jME Physics 2) and export it, so i could use it in game without having to set up physic again (it will be some kind of modeler for my game), but im gettings some errors ( i wrote it already http://www.jmonkeyengine.com/forum/index.php?topic=11898.0 ). If i use some thing like in following piece of code (with some Box)
PhysicsSpace pSpace = PhysicsSpace.create();
pSpace.setupBinaryClassLoader(BinaryImporter.getInstance());
DynamicPhysicsNode pNode = pSpace.createDynamicNode();
Box some_box = new Box( “some_box”, new Vector3f(), 5, 0.25f, 5 );
pNode.attachChild(some_box);
pNode.generatePhysicsGeometry();
File phys_file = new File("/home/users/pablo/phys_model.xml");
try {
XMLExporter.getInstance().save(pNode, phys_file);
//Node tmpNode = (Node)XMLImporter.getInstance().load(phys_file);
} catch (IOException e) {
e.printStackTrace();
}
<MapEntry>
<Key class=‘com.jmex.physics.material.Material’ density=‘0.9’ name=‘ice’ reference_ID=‘com.jmex.physics.material.Material@14982605’>
<contactHandlingDetails>
<MapEntry>
<Value bounce=‘0.2’ class=‘com.jmex.physics.contact.MutableContactInfo’ dampingCoefficient=‘NaN’ minimumBounceVelocity=‘1.0’ mu=‘0.0020’ muOrthogonal=‘NaN’ springConstant=‘NaN’>
<sufaceMotion class=‘com.jme.math.Vector2f’/>
<slip class=‘com.jme.math.Vector2f’ x=‘NaN’ y=‘NaN’/>
<frictionDirection class=‘com.jme.math.Vector3f’ x=‘NaN’ y=‘NaN’ z=‘NaN’/>
</Value>
</MapEntry>
PhysicsSpace pSpace = PhysicsSpace.create();
pSpace.setupBinaryClassLoader(BinaryImporter.getInstance());
File phys_file = new File("/home/users/pablo/phys_model.xml");
try {
Node tmpNode = (Node)XMLImporter.getInstance().load(phys_file);
} catch (IOException e) {
e.printStackTrace();
}
java.io.IOException: java.lang.InstantiationException: com.jmex.physics.impl.ode.DynamicPhysicsNodeImpl
at com.jme.util.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:978)
at com.jme.util.export.xml.XMLImporter.load(XMLImporter.java:75)
at com.jme.util.export.xml.XMLImporter.load(XMLImporter.java:119)
at gProject0.samples.PhysicExportTest.simpleInitGame(PhysicExportTest.java:36)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:545)
at com.jme.app.BaseGame.start(BaseGame.java:74)
at gProject0.samples.PhysicExportTest.main(PhysicExportTest.java:21)
Caused by: java.lang.InstantiationException: com.jmex.physics.impl.ode.DynamicPhysicsNodeImpl
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at com.jme.util.export.xml.DOMInputCapsule.readSavableFromCurrentElem(DOMInputCapsule.java:1005)
at com.jme.util.export.xml.DOMInputCapsule.readSavable(DOMInputCapsule.java:969)
… 6 more
PS:
Sorry for my English.