[SOLVED] AnimControl getControl Problem


I have a Problem with the Node.getControl method it does not set the AnimControl. What am I doing wrong? This is the code (Problem in Line 70):

package mygame;

import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.app.SimpleApplication;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Main extends SimpleApplication
    AnimControl kontrolle;
    AnimChannel kanal;

    public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
            public void run()
                AppSettings settings = new AppSettings(true);
                Main canvasApplication = new Main();
                canvasApplication.createCanvas(); // create canvas!
                JmeCanvasContext ctx = (JmeCanvasContext) canvasApplication.getContext();
                Dimension dim = new Dimension(640, 480);
                JFrame window = new JFrame("Swing Application");
                JButton test = new JButton("Hallo");
                test.setBounds(0, 0, 200, 50);
                window.setSize(640, 480);
    public void simpleInitApp()
        Node testObjekt = (Node)assetManager.loadModel("Textures/testObjekt/testObjekt.j3o");
        kontrolle = testObjekt.getControl(AnimControl.class);
        kanal = kontrolle.createChannel();
        PointLight licht = new PointLight(new Vector3f(0.5f, 2, 1), new ColorRGBA(1, 1, 1, 1), 10);


    public void simpleUpdate(float tpf)
        //TODO: add update code

    public void simpleRender(RenderManager rm)
        //TODO: add render code

3.3+ version of JME use AnimComposer instead AnimControl class (models converted using 3.3 version)

First for the future (or if you want to edit your post): How to type code blocks

Second, what oxplay says is true but it also could be that the control is not on the node but on one of the children. We’d have to know more information about JME version, where you got the j3o file, etc… We don’t even really have enough information to know if it should have an animation control.

well I use the 3.3.2 sdk.
I tried to do it like in the Tutorial

is there a Tutorial on using AnimComposer as well?

i think that Wiki you linked is confusing, because Test Model it uses probably have old Control class in it. @mitm i thought 3.3 wiki use new Animation class in it. seems like it didnt.

@Dares see links:

and other files inside:

You can open it in SDK by New Project → JME → JME Tests project → Run → search for animation test

it works,
thank you


It requires someone who uses the new system to write about it. I have not used it but I am saving forum posts about it so I can gather it all together into something that makes sense once I do.

As the wiki is open to anyone, anyone can freely contribute, but that has not happened yet. So here we are.

I don’t have the time right now to do anything for a short while to come.

1 Like

thanks for info, currently having mind in networking topic, but if noone will do it, i will try myself make some pull request. (just hope we had some GLTF model in test-repo there)

There is a duck gltf on engine site in testdata believe. I think Oto and Sinbad uses new system also.

yes, old models should work too, i just thought that many new users had problems with “older formats” so it would be better them to see GLTF instead “ogre.mesh” so they use new one :slight_smile:

so it would be good to convert old models to gltf version of them.

Yes, there are open source gltf I have seen myself with cc0 that can be used.