Non-armature blend file animation not working

I have a blend file with a model with a working animation in blender that does not use an armature.



I can successfully import the model and display it, but when I try to add an animation controller I get a null pointer instead.



Here is the file:

http://uploading.com/files/c5mam2d3/imptrial1.blend/



Here is the code:

[java]public class Main extends SimpleApplication {



private AnimChannel channel;

private AnimControl control;



public static void main(String[] args) {

Main app = new Main();

app.start();

}



@Override

public void simpleInitApp() {

flyCam.setMoveSpeed(10f);

cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));

cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));



DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());

dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));

rootNode.addLight(dl);





Spatial scene = (Spatial) assetManager.loadModel(“Models/imptrial1/imptrial1.j3o”);

rootNode.attachChild(scene);



Spatial model = this.findNode(rootNode, “leftWing”);

//model.center();



control = model.getControl(AnimControl.class);

channel = control.createChannel();



channel.setAnim(“leftWingFlap”);

//channel.setAnim(“rightWingFlap”);

}



/**

  • This method finds a node of a given name.
  • @param rootNode the root node to search
  • @param name the name of the searched node
  • @return the found node or null

    */

    private Spatial findNode(Node rootNode, String name) {

    if (name.equals(rootNode.getName())) {

    return rootNode;

    }

    return rootNode.getChild(name);

    }

    }[/java]

What kind of animation is it? Normally only bone animation is supported (e.g. OgreXML), the blender importer supports some other animation methods but really bone animation is the best to use in games.

It’s a rotation of 2 mesh objects representing wings. I tried armatures but I just found out you can’t have more than one armature and I can’t figure out how to flap 2 wings with just one armature.

What kind of animation? What animation function do you use in blender? You flap two wings with an armature by creating one root bone and then connecting two bones to that, one for the left and one for the right wing…

Share the armature between them in blender. Go to object


>link
>armature or something like that.
Also, why are using two armatures for the wings? Why don't you just create one armature with two bone........

ObjectAnimations are afaik only for 2.49 at the moment. You had a real strange setup with NLA!?

You should start with some tutorials about rigging and animating…

I made a simple rig and a crappy animation (fly). Check this out: http://dl.dropbox.com/u/11752001/imptrial1.blend

But please wait 45secs before downloading…(I hate that download-services…plz search for a better solution)

1 Like
ObjectAnimations are afaik only for 2.49 at the moment


No, you can use blender 2.6 as well :). Just make your jmp up to date and follow the following advices : http://hub.jmonkeyengine.org/groups/general-2/forum/topic/animations-arent-working-at-all/?topic_page=2&num=15#post-148647

Hmm,…but they are speaking about armature-animations, or did I miss something?

ObjectAnimation is to animate the object-data (like transform,scale,rotation) of the whole object with keyframes but without bones. Would be cool if that is really supported but I’m quite sure that this us 2.49 only :frowning: And actually I was talking about blend-import not ogre…just for info!

Hmmm! I never heard nothing about animations without bones, just key shapes. Does it really exist? Btw, I animate a whole model by using a armature modifier with a bone which is connected to all model’s vertices. Then I’m able to transform it. Also, the BlenderLoader is still WIP, then I use the OgreXml at moment.

in game engines ObjectAnimation should be made by code with simpleUpdete() method. Or with Custom Controls. You can scale, move rotate objects inside of your code. Just make a Custom Control and add it to your object.



Have a look at this: http://hub.jmonkeyengine.org/groups/jmonkeyplatform/forum/topic/load-and-edit-custom-controls-in-scenecomposer/



You can make it with scene viewer or inside of your code.

Also, simple example is here:

http://code.google.com/p/jme-simple-examples/source/browse/JMESimpleExamples/src/MifthBasics/SpatialMotionsLinear.java

http://code.google.com/p/jme-simple-examples/source/browse/JMESimpleExamples/src/MifthBasics/SpatialMotionsNonLinear.java

http://code.google.com/p/jme-simple-examples/source/browse/JMESimpleExamples/src/MifthBasics/SpatialMotionsSmooth2.java

I don’t see the point here. The question was why ObjectAnimations imported by the blender-importer do not work. Not how you can create

them without!?

(@glaucomardano:And yes, they exist. They work the same like setting a bone’s rotation/trans/scale. In objectmode just press I select the values of interest go to next key frame change object-settings e.g. scale, hit I again…quite easy.)

Of course you can achieve optical the same result with bone-animation but an objectanimation is much cheaper in calculation.

@mifth Why should you do ObjectAnimation in code? Both have their use-cases. Actually it is perfect if you have the option to do that in Blender as well and the Importer creates the control on the fly (with IPO-Curves!!!). Imagine you have something like a windmill. The you can create the rotation of the wings in blender. No need to get the node, write a controller and attach it. Actually you can do everything that doesn’t have interactivity. Might be perfect for whole cutscenes!? :smiley: For a character of course you should do it in code.


(@glaucomardano:And yes, they exist. They work the same like setting a bone’s rotation/trans/scale. In objectmode just press I select the values of interest go to next key frame change object-settings e.g. scale, hit I again….quite easy.)
Of course you can achieve optical the same result with bone-animation but an objectanimation is much cheaper in calculation.


AAahhhhhhhhh! yes. I forgot it :P. I'm accostumed to animate the bone, and not the model itself :). I really prefer animate the skeleton, because I reuse the skeleton for my models ;).

For BlenderObjectAnimation also have a look at: jme3test.model.anim.TestBlenderObjectAnim in the test-folder!

@ttrocha , blender-heads made these tools to animate objects in blender editor by yourself. You cannot import it into JME. There is no such a tool in JME like IPO-curves, “object aimation system”, etc… If you want you may write such tools. Blender “object aimation system” will be imported to JME like Custom Controls, or like one rootbone with animation. But there is no sence to do it. All professionals use either Bones, or Custom Controls with simpleUpdate() method.



If you notice… “bone animation” and “object animation” are different things in Blender. They work differently. For example, rotations.



So, man!!! If you want to animate object - use Custom Controls with simpleUpdate() method, or use skeleton animation.

Haha, just back again in jME3-Forums and it is like I never left :smiley:



@mifth: Hmm,…you seem to be very sure!? Well, one who knows how the professionals work…


You cannot import it into JME.

Well, that is the point you seem not to understand. You can. And if you at least had a look at the TestBlenderObjectAnim you would know
so. But it is blender 2.49 only at the moment.

Btw, IPO-Curves are curves not more not less and you are right that they are imported as 'Custom Control' or more specifi as AnimControl by the Blender-Importer. Actually, I don't know if they are really acting as an curve or just linear (which I assume) after import...have to check this one time...

If you notice… “bone animation” and “object animation” are different things in Blender. They work differently. For example, rotations.

Hmm,..I know! Actually I said that! I know it was much text in the posting...

But there is no sence to do it

Well, I found my example not that bad!

So, man!!! If you want to animate object – use Custom Controls with simpleUpdate() method, or use skeleton animation.

Lol, don't be so black and white!

So and just for you a smiley :D
AND I created just for you as well a small sample that you can load with the TestBlenderObjectAnim-Test: http://dl.dropbox.com/u/11752001/animtest2.blend

In fact the blender importer starts to support other animation types but we only slowly adapt them, as all animation classes in jME3 are final to avoid fragmentation like in jME2

@ttrocha , ok. I was too impulsive. I see JME developers make something cool.



By the way, Ipo-curves 2.49 and ipo-curves 2.6 are very different. Animation system was rewritten in blender.

Yeah, too bad the blender-importer-guy (still don’t know his name, i just call him BIG :D) made the decision to start with 2.49 first

as you can load 2.49 stuff (including Animations) in 2.5+ and just have to save the file and have it in 2.5-format!

Now he have to do the work twice just to keep compatibilty to the my former beloved old 2.49 :smiley:

1 Like
@ttrocha said:
Yeah, too bad the blender-importer-guy (still don't know his name, i just call him BIG :D) made the decision to start with 2.49 first
as you can load 2.49 stuff (including Animations) in 2.5+ and just have to save the file and have it in 2.5-format!
Now he have to do the work twice just to keep compatibilty to the my former beloved old 2.49 :D

His name is actually Kaelgaga .. Dunno where he is, maybe at a concert
Hopefully when he comes back he can take a look at those issues