hey there, im using 3ds max 9 and the Ogre3D exporter to get my beloved ‘bubblehead’-avatar into JME 3 (newest version inc. updates).
I created 3 animations with biped: stand, walk and jump in 3ds and exported them via ogre to load them into JME. I’m currently using the ‘Hello Animation’ code https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_animation to test things out but i can only run 1 animation.
how i do it atm:
- in 3ds max i open up my file and load the .bip animation onto my model.
- I use the ogre exporter, select my 3 animations to be exported.
3)Now I copy the material,mesh and skelett in my JME direktion and change the directories in JME so thei point to my exported files.
When i run my file now my ‘bubblehead’ is just jumping… whatever i do i dont get him to enter the ‘walk’ or ‘stand’ animation.
I have already found out, that the animation hes stuck into is always the last one i loaded(like in step 1).
please help bubblehead to walk and jump
TaiTen
PS: my code:[java]package jme3test.helloworld;
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.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
/** Sample 7 - how to load an OgreXML model and play an animation,
- using channels, a controller, and an AnimEventListener. /
public class HelloAnimation extends SimpleApplication
implements AnimEventListener {
private AnimChannel channel;
private AnimControl control;
Node player;
public static void main(String[] args) {
HelloAnimation app = new HelloAnimation();
app.setShowSettings(false);
app.start();
}
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.LightGray);
initKeys();
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
rootNode.addLight(dl);
player = (Node) assetManager.loadModel("Models/bip/bip.mesh.xml");
player.setLocalScale(0.05f);
rootNode.attachChild(player);
control = player.getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
channel.setAnim("stand");
}
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
if (animName.equals("jump")) {
channel.setAnim("stand", 1.50f);
channel.setLoopMode(LoopMode.Loop);//(LoopMode.DontLoop) um die Animation nicht in einer schleife, also nur 1 mal abzuspielen
channel.setSpeed(10f);
}
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
// unused
}
/* Custom Keybinding: Map named actions to inputs. */
private void initKeys() {
inputManager.addMapping("jump", new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addListener(actionListener, "jump");
}
private ActionListener actionListener = new ActionListener() {
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals("jump") && !keyPressed) {
if (!channel.getAnimationName().equals("jump")) {
channel.setAnim("jump", 1.50f);
channel.setLoopMode(LoopMode.Loop);
}
}
}
};
}[/java]