Motion Group explained

Motion group is a convenient way of groping component animations of a 3D object scoped. For example, walking motion of a 3D character consists of translations and rotations of each part of a body (skeleton) and could yield a tens of single transformation sequences applied to each part. In Cast3D terminology they are call tracks.

Essentially, Motion Group is collection of individual tracks. Each track in a group is bound (applied) to a scene node. There are two representations of a Motion Group in Cast3D. First is MotionGroup class within AS3 Cast3D framework, second is corresponding <motiongroup> XML element in .Xc3 file format. On a .xc3 file load MotionGroup class is being instantiated and populated with data from <motiongroup> elements.

MotionGroup class is derived from Track3d, which defines it's behavior as any other track. But there are few differences:

I need to explain this in a bit more details. The way tracks are linked to a particular scene node is defined in .xc3 file with following example:

    <node id="Bone" parent="" type="spine" >
      <bind bind_id="translate_Bone" context="track" path="tracks"></bind>
      <bind bind_id="rotateZ_Bone" context="track" path="tracks"></bind>
      <bind bind_id="rotateY_Bone" context="track" path="tracks"></bind>
      <bind bind_id="rotateX_Bone" context="track" path="tracks"></bind>
      <bind bind_id="scale_Bone" context="track" path="tracks"></bind>
      <rotationtrack id="rotateX_Bone" start="0" end="10" enabled="true" timeline="CLAMP" >
      <bind bind_id="rotateX_Bone_spline" context="spline" path="sampling"></bind>
      <bind bind_id="rotateX_Bone_data" context="trackdata" path="data"></bind>

As you can notice, binding a track happens with referencing a track with <bind> within <node>. Technically, you can apply same track to a number of nodes.

Binding a MotionGroup to a node is done the same way, by using <bind> to a group track within <node>. Since groups hold all tracks they need to attach those tracks to right scene node. Naturally, the way to do so would be to bind a track to a node by a node id.

<motiongroup id="Cube_motion" start="0" end="30" enabled="true" timeline="REPEAT" offset="0">
  <bind bind_id="translate_Cube" context="Cube" path=""></bind>
  <bind bind_id="rotateZ_Cube" context="Cube" path=""></bind>

In a snapshot above translate_Cube would be a position track id and in context=“Cube”, Cube would be node id. Which is very close to truth, but instead, Cube is not a node id, but a node type.

That is done on purpose. Node type is an attribute that indicates the context meaning of a node. For, example, it could be “hand_left” or “foot_right” etc.. So, if you extract MotionGroup into a separate file ( see tutorial Creating Interactive scene.) you can, perhaps, apply motion group to another model, if you use consistent node naming. Just make sure models are in same units, or adjust positional tracks as they may stretch model. Rotations should work fine.

In practice, if you export model from Blender to COLLADA 1.4 file, node types will have same values and node ids. Also Da2Xc3 import utility always tries to combine tracks into group, if possible. And if you use '-xm' option it will store <motiogroup> data in separate file(s). In main xc3 file these data will be replaced with <include> statement corresponding to file.

To summarize the way a MotionGroup does binding, for each descendant node of the node MotionGroup is applied, it tries to find all tracks with the same node type and applies them to that node.

MotionGroup is very effective way of representation of a distinctive and separate animation sets for a particular 3D object, like walking, jogging, jumping etc.. motions of a character. There are few tutorials that show how to extract and work with MotionGroups:

* Creating Interactive scene.

* Cloning 3D objects of scene.

There is also another article which explains animation blending process with combining MotionGroups into a single motion.