Sorry if this has already been asked, not even sure how to word the question. i have a model that i am trying to load up multiple times and have different animations executing. when i load up the model twice and play an animation on one it plays it for both instances, here is my test case:
[java]
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.animation.LoopMode;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
public class AvatarTestCase extends SimpleApplication{
public static final String avatarModelLocation = “Models/avatars/businessman/My_Avatar__1.j3o”;
public static void main(String args[]){
AvatarTestCase app = new AvatarTestCase();
app.start();
}
@Override
public void simpleInitApp() {
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);
Node avatar1 = (Node) assetManager.loadAsset(AvatarTestCase.avatarModelLocation);
avatar1.setLocalScale(5f);
rootNode.attachChild(avatar1);
AnimChannel avatar1Channel;
AnimControl avatar1Control;
avatar1Control =avatar1.getControl(AnimControl.class);
avatar1Control.addListener(new MyAnimationListener());
avatar1Channel = avatar1Control.createChannel();
avatar1Channel.setLoopMode(LoopMode.Loop);
avatar1Channel.setAnim(“Run”);
Node avatar2 = (Node) assetManager.loadAsset(AvatarTestCase.avatarModelLocation);
avatar2.setLocalScale(5f);
rootNode.attachChild(avatar2);
AnimChannel avatar2Channel;
AnimControl avatar2Control;
avatar2Control = avatar2.getControl(AnimControl.class);
avatar2Control.addListener(new MyAnimationListener());
avatar2Channel = avatar2Control.createChannel();
avatar2Channel.setAnim(“Walk”);
avatar2Channel.setLoopMode(LoopMode.Loop);
}
}
class MyAnimationListener implements AnimEventListener{
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
channel.setLoopMode(LoopMode.Loop);
channel.setAnim(animName);
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}
}
[/java]
Let me know if its something obvious with my code or if its something with my model, ill up the model if ya’all think its something wrong with that.
Thank you in advance
-Allman
Update to the latest stable version (Help->Check for Updates)
Thanks for the quick reply normen,
When i update to the lates stable i get an exception when i try to load up my models:
[java]
java.lang.IllegalArgumentException: No enum const class com.jme3.scene.VertexBuffer$Type.BindPoseTangent
at java.lang.Enum.valueOf(Enum.java:196)
at com.jme3.export.binary.BinaryInputCapsule.readEnum(BinaryInputCapsule.java:1375)
at com.jme3.scene.VertexBuffer.read(VertexBuffer.java:902)
at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:357)
at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:484)
at com.jme3.export.binary.BinaryInputCapsule.readIntSavableMap(BinaryInputCapsule.java:685)
at com.jme3.scene.Mesh.read(Mesh.java:1176)
at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:357)
at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:484)
at com.jme3.export.binary.BinaryInputCapsule.readStringSavableMap(BinaryInputCapsule.java:668)
at com.jme3.scene.Spatial.read(Spatial.java:1286)
at com.jme3.scene.Geometry.read(Geometry.java:534)
at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:357)
at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:484)
at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:472)
at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:588)
at com.jme3.scene.Node.read(Node.java:599)
at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:357)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:264)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:147)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:131)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:243)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:376)
[catch] at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:89)
at com.jme3.gde.scenecomposer.OpenSceneComposer$1.run(OpenSceneComposer.java:44)
at java.lang.Thread.run(Thread.java:662)
[/java]
@Momoko_Fan, is there some incompatibility with animations within beta? @allman: Try re-converting the model from ogre or whatever the original format was as a workaround.
Reconverting works to let me load up the model but it does not let me play the model animations now
Working! just had to restart the IDE for each model
Procedure for binary Ogre xml files:
update lates stable JMP
update to lates ogre tools
user@comp / $ OgreXMLConverter MyModel.skeleton
user@comp/ $ OgreXMLConverter MyModel.mesh
in JMP import MyModel.mesh.xml
restart JMP
???
profit!
Thanks normen for the speedy reply
P.s
How do you mark a topic solved? im not good with computer
Ok good. If you copy the binary ogre files to the project assets directory you can convert them directly, the ogre command line tools are integrated in the SDK.
This error happens if a new model is being loaded on old jME3