Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main] java.lang.Null

Or, maybe, something wrong in j3o file? Or im just wrong make request to AnimControl???

@Separator2 said: In the post above, I have posted the source code and 3D models. Please, help me understand, what wrong in blend model, and why AminControl not available?

Can you tell us what’s at line?
at mygame.Main.simpleInitApp(Main.java:41)

Help us help you and don’t make us jump through so many hoops.

The source code:
[java]
package mygame;

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;

/**

  • test

  • @author normenhansen
    */
    public class Main extends SimpleApplication implements AnimEventListener {
    private AnimChannel channel;
    private AnimControl control;
    Node player;

    public static void main(String[] args) {
    Main app = new Main();
    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/Radar/rad.j3o”);
player.setLocalScale(0.5f);
rootNode.attachChild(player);
control = player.getControl(AnimControl.class);
control.addListener(this);
//channel = control.createChannel();
//channel.setAnim(“Forward”);
}

public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
if (animName.equals(“Forward”)) {
channel.setAnim(“Forward”, 0.50f);
channel.setLoopMode(LoopMode.DontLoop);
channel.setSpeed(1f);
}
}

public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
// unused
}

/** Custom Keybinding: Map named actions to inputs. */
private void initKeys() {
inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addListener(actionListener, “Forward”);
}
private ActionListener actionListener = new ActionListener() {
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals(“Forward”) && !keyPressed) {
if (!channel.getAnimationName().equals(“Forward”)) {
channel.setAnim(“Forward”, 0.50f);
channel.setLoopMode(LoopMode.Loop);
}
}
}
};
}

[/java]

Ok, so presuming the lines are all the same from the stack trace:
control.addListener(this);

So, yes, indeed your j3o does not have animation in the root node.

You stated earlier:
“In scene composer i can observe the AnimControl branch with 2 actions (stand and Walk, like in tutorials).”

But it’s unclear whether this was in the root object of the j3o or some sub-node.

In SceneExplorer:
Models/Radar/rad.blend
–Armature
----Cube
------Cube1
------AnimControl
--------Walk
--------stand
------SkeletonControl
Some like this :slight_smile:
How can i move up AnimControl in hierarchy???

Ohh. I move up the Anim control and vyola!!! Its working. Thanx all :slight_smile: