3
$\begingroup$

I'm working on importing a model and an animation for it from blender into Spring RTS. There are the following tools at my disposal:

  • Capability of the engine to import Collada via Assimp library. This function does not understand riggings and skeletons, so the only way to get an import of a structured animatable model is by constructing an object hierarchy with parent-child relations.

  • Capability of a third-party tool to convert BVH animations into animation scripts understood by the engine. Blender BVH export refuses to work on object hierarchies, so I need an armature (and I'd want one anyway).

This causes me to try inventing some hybrid approach. So far I've tried creating a separate, yet perfectly matching armature (for animation export and own convenience) and an object hierarchy (for model export), with intent to then constrain the individual objects in the hierarchy to follow their corresponding bones in the armature.

This way I could visualize the animations on a wysiwyg model, and export both the model and the animation to work in the engine.

However, I seem to failing at the constrain step, since the very first object I try to constrain to follow a bone via Transform, Copy Transform and Copy Rotation constraints, seems to be somehow strangely rotated from its start position.

What am I doing wrong? How would I do this right? Are there any different, better approaches?

$\endgroup$

2 Answers 2

1
$\begingroup$

I'm assuming that you've already copied the object's starting rotation to match the rotation and roll of the bone. You might need to apply this rotation (Ctrl+A) in order for the constraints to start working properly.

Another possibility is that you might be experiencing Gimbal lock on your objects. Armatures don't exhibit this problem because their default rotation type uses quaternions, whereas objects default to Euler rotations. Fortunately, you can change the rotation type for objects (3D View > Properties region (N) > Transform panel > Rotation) from XYZ Euler to Quaternion (WXYZ).

Try that and see if you're still running into rotation issues.

$\endgroup$
1
  • $\begingroup$ I've done some experiments with rigorous apply-rotation and scaling the bones to match global axes. Apparently, the z-axis of the first child bone somewhy turns 90 degrees from its parent bone, which caused what appeared like an axis swap. No idea why, or how to go around that 0_0. $\endgroup$
    – user769102
    Aug 27, 2013 at 18:47
0
$\begingroup$

In the end it came down to the fact that bone axes are special.

A bone's Y axis always points along the length of the bone, while X and Z are perpendicular to it and each other, and can be rotated with bone's roll.

Thus, a bone pointing along the spine of an upright Z-up character can never align with global Z-axis, resulting in 90-degree offsets and axis inversions.

I ended up using a tailored Transform constraint to remap the bone axes to object axes so that local bone rotation translated correctly into local object rotation.

The hideous part is that if bones point in a different direction - say, horizontal bones for stretched-out robot arms - the set of adjustments will be different for each of them (and if robot has two arms, their adjustments will have to be different).

I'll yet have to see how/if the special bone axis thing will hilariously backfire when i try exporting an animation.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .