Animation working in Blender 2.63 but badly distorted in jME

Hi,

I know there has been lots of thread related to animation problems but so far I haven’t seen any conclusions that seem related to my problems and many of them didn’t provide much information upfront. (I’m sorry if there is solved thread that I didn’t find)

I have model in Blender with “Walk”-animation. Animation works fine in Blender but after using Ogre exporter (the one bundled with jME SDK) and converting it to j3o works but animation is badly distorted. In blender both legs move as expected but in jME left leg barely moves and right is distorted.

Both meshes and armature’s position, rotation and scale have been applied.
Model has root-bone at 0, 0, 0, pointing upwards.
Both armature and mesh have their origin at 0, 0, 0
Bone envelopes have been unchecked
Armature is mesh’s parent

I used SkeletonDebugger and noticed that bones move correctly.
I have tested with Blender 2.63a and 2.70a. With 2.70a and latest ogre exporter, I get IndexOutOfRange error, with 2.63a and bundled ogre exporter, I get problem that I described.

I have tried both stable and nightly versions of jME. Same problem with both.

I seletected both armature and mesh and then exported with following settings:

  • copy shader programs
  • swap axis xz-y (default)
  • Export Selected Only
  • Export Meshes
  • Export Meshes (overwrite)
  • Armature Animation
  • Shape animation (tried without this too)
  • Trim Weights: 0.10
  • Optimize Arrays
  • Export Materials (tried without this too)
  • Tangents
  • Reorganize buffers
  • Optimize animations (tried without this too)

Exporting gives no errors.

Blender model
SkeletonDebugger

(My OS is 32-bit Kubuntu 14.04)

Best guess is that your model was moved/scaled/rotated out of edit mode.

If any of the global transforms are different than:

position: 0, 0, 0
scale: 1, 1, 1
rotation: 0, 0, 0

Then you need to set them to this and reapply whatever you were trying to do in edit mode (local transforms)

Hi and thanks for your answer!

I forgot to mention that I didn’t do model or animation but “MajorNightmare” did. Here’s link to original:

I only removed some extra stuff that wasn’t really needed like custom bone shapes and lights. I also used decimate-modifier (and applied it) because model had too many polygons. Then I applied mirror.

Could it be that the order in which I applied mirror and decimated could cause the problem?

Then you need to set them to this and reapply whatever you were trying to do in edit mode (local transforms)

I’m not sure if I understood what you mean. Do you mean that if pos, rot and scale weren’t set to (0, 0, 0), (0, 0, 0) and (1, 1, 1) before doing the animation, I would need to reanimate it?

The only things I (as far as I remember) have done in edit mode is to create new root bone for armature and set old root bone as it’s child because I couldn’t rotate old root bone to vertical position.

I also checked original mesh and armature and it too had pos: (0, 0, 0), scale: (1, 1, 1) and rot (0, 0, 0)

To answer my question:

Could it be that the order in which I applied mirror and decimated could cause the problem?

Apparently it didn’t matter because problem happens even when I don’t decimate.

One thing I noticed that armature uses lots and lots of constraints. If I remove them directly, animations don’t work in Blender either. According to this comment from 2010, one should not use constraint based animations. I tried to bake animation with “clear constraints” -option but without success (animation stopped working).

Probably going to another one of those “check the obvious” statements… but, ya never know!

Are there any modifiers that have not been applied to the model? If so… apply then and then re-export the model.

Thanks again for helping.

Apart from armature modifier, there are no other modifiers left. Checked both Armature and Mesh, multiple times.

Can you post a screen shot of the badly distorted animation? (With skeletal debugging on would be best)

Yeah sure

I have to wonder though, don’t you think that it would saved both of our time if you had downloaded blend and skeletal debugger (which has the model with it in j3o format) that I provided upfront.

Thanks for your time anyway

I think I was able to bake animations correctly (with Blender 2.70a) because animation still worked in Blender after removing constraints. It didn’t seem to affect jME at all though. Actually, that screenshot was taken with baked animation and it looks exactly same as with constraints.

That rig uses Inverse Kinematics which doesn’t work in JME.
I had a lot of problems with getting that to work as well, the solution for me was to make a second rig which only contained the bones the mesh was weighted to with “copy transforms bone constraint” set to the IK rigged skeleton. I could then bake the keyframes to that skeleton, remove to constraints and import it. It was a pain to set up but worked fine after that.

Also another problem could be that you are using Quaternion rotations for the skeleton, the current Version of JME does support that but it was a pretty recent addition and I’m not sure if it’s in the latest nightly build.

@Perjin said: That rig uses Inverse Kinematics which doesn't work in JME. I had a lot of problems with getting that to work as well, the solution for me was to make a second rig which only contained the bones the mesh was weighted to with "copy transforms bone constraint" set to the IK rigged skeleton. I could then bake the keyframes to that skeleton, remove to constraints and import it. It was a pain to set up but worked fine after that.

Also another problem could be that you are using Quaternion rotations for the skeleton, the current Version of JME does support that but it was a pretty recent addition and I’m not sure if it’s in the latest nightly build.


You’re talking about the blender importer, the OP is using the ogre pipeline which supports Inverse Kinematic.

@dnyarri, it really looks like unapplied transforms as @t0neg0d mentioned. But there is an easy way to apply them, in the 3D view in object mode select the model and hit ctrl+A and choose location then rotation then scale from the menu. then select the armature and do the same. Save and export again.

@nehon I have applied loc, rot and scale many times before opening this thread and many times after opening the thread, exactly like you described. Nothing changed. Animation looks exactly the same. Just to be sure I applied them again on both mesh and armature ––> saved ––> Exported ––> Converted to j3o-binary ––> Played animation in Scene Composer. Still the same problem.

Just to be sure, I just went through the model checklist and made sure everything was as it should be, reading it, comparing my view to checklist’s screenshots etc. Everything seems to be correctly …

… but the animation just doesn’t work correctly.

Thank you for your time though. I always appreciate it when someone donates time for someone else.