Hello.
I was doing quick-animations few days ago just only for “working” but now need to rebuild that. I got animations for different Keys and mouse click but I need to set up standing/idle animation (randomly chosed by java). Here’s the code, I want currentStandAnim to be played like .reset work already. (when i stop pressing any key now my animations are reset.) but with possibility to stop it in any time when player press the key, even when idle anim isn’t finished.
[java] currentStandAnim = getRandomStand();
Node rigNode = (Node) playerModel.getChild("rig");
for (Spatial sp : rigNode.getChildren()) {
AnimControl animCtrl = sp.getControl(AnimControl.class);
if (animCtrl.getNumChannels() == 0) {
animCtrl.createChannel();
}
AnimChannel channel = animCtrl.getChannel(0);
if (up || down || right || left && isDefending == false) {
if (channel.getAnimationName() == null) {
if (isAccelerate == false) {
channel.setAnim(anim10, 1f);
} else {
channel.setAnim(anim11, 1f);
}
channel.setLoopMode(LoopMode.Loop);
}
} else if (hit && isDefending == false) {
if (channel.getAnimationName() == null) {
channel.setAnim(currentAnim);
channel.setLoopMode(LoopMode.DontLoop);
}
} else if (isDefending) {
if (channel.getAnimationName() == null) {
channel.setAnim(currentDefAnim);
channel.setLoopMode(LoopMode.DontLoop);
}
} else {
channel.reset(true);
}[/java]