[SOLVED] Unsupported animation

i’m trying how to control animation, but i got unsupported problem here is my code

public class HelloAnimation extends SimpleApplication implements AnimEventListener{

private AnimChannel channel;
private AnimControl control;
private Node player;

public static void main(String[] args){
    HelloAnimation app=new HelloAnimation();
    app.start();
}

@Override
public void simpleInitApp() {
    this.flyCam.setMoveSpeed(50);
    
    viewPort.setBackgroundColor(ColorRGBA.LightGray);
    DirectionalLight dl=new DirectionalLight(
    new Vector3f(-0.1f,-1f,-1).normalizeLocal());
    rootNode.addLight(dl);
    player=(Node)assetManager.loadModel("Models/animPlayer.j3o");
    player.setLocalScale(0.1f);
    rootNode.attachChild(player);
    control=player.getChild("Cube").getControl(AnimControl.class);
    control.addListener(this);
    channel=control.createChannel();
    
    channel.setAnim("Action", 1);
}

@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

}

Let me guess you have an UnsupportedOperationException : Not Supported yet. exception?
Here is some hint: 99% of the time you’ll have to edit the code the IDE has generated for you.

1 Like

sorry i dont understand what do u mean (my englis is bad) can u tell me what should i do?

@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

You added this, the IDE generated the methods for you and if you look carefully into it, it throws the exception.
Just remove the throw new UnsupportedOperationException in both methods… or better dont even add the listener to the control as it does nothing here.

3 Likes

oh yeah, i clean the trower and it work. thanks