Plask API output guideline

3D Model set up

  • Before importing the model into the Unity Scene, it is necessary to align the local axis of the Plask API output with the local axis of the 3D model.

  • The rigging to align the axis of the 3D Model to be used is done according to the document below.

    Set up the model’s rigging for Plask API data

  • An example of applying motion capture data without correction calculation to a model that does not align the local axis.

API output structure

The API output is a json file with the structure shown in the example below.

{
    "result": [
        {
            "motionNumber": <motion index>,
                    "trackData": [
                                {
                                  "boneName": <bone name>,
                                  "fps": <frames per second>,
                                  "property": <Transform type(position or rotationQuaternion)>,
                                  "transformKeys": [
                                        {
                                              "frame": <frame number>,
                                              "time": <time with keyframes>,
                                              "value": [
                                                    <position(3) or quaternion(4) values>
                                              ]
                                        }
                                  ]
                            }
                        ]
        }
    ],
    "workingtime": <Time taken for motion capture>
}

    • Example

      response.json

      {
      "result": [
      {
      "motionNumber": 0,
      "trackData": [ ...
      ]
      }
      ],
      "workingtime": 55.64448 4758377075
      }
  • Motion capture data is included in “result”>”trackData”. It has position values (x, y, z) or rotation values (x, y, z, w) based on a skeleton with 24 bones. The bones are composed as follows.

    Source bone structure

  • In the “result”>”trackData” array, hips have position and quaternion type values, and 23 bones excluding hips have only quaternion type values, so there are a total of 25 elements. Each element consists of boneName, fps, property and transformKeys.

    "trackData": [
            {
                    "boneName": "hips",
                    "fps": 30,
                    "property": "position",
                    "transformKeys": [ 
                            {
                                    "frame": 0,
                                    "time": 0,
                                    "value": [
                                            0.06301826238632202,
                                            0,
                                            0.2913147509098053
                                    ]
                            },
                            ...
                    ]
            },
            {
                    "boneName": "hips",
                    "fps": 30,
                    "property": "rotationQuaternion",
                    "transformKeys": [ ...
                    ]
            },
            {
                    "boneName": "leftUpLeg",
                    "fps": 30,
                    "property": "rotationQuaternion",
                    "transformKeys": [ ...
                    ]
            },
            ...
            {
                    "boneName": "rightHandIndex1",
                    "fps": 30,
                    "property": "rotationQuaternion",
                    "transformKeys": [ ...
                    ]
            },
    • boneName is the name of the bone with motion capture data.
    • fps is the fps of the video to extract motion.
    • property is the type of transform value.
    • transformKeys is an array with time and value for each pose. Each pose has frame, time, and value information.
      • frame is the frame order of the pose.
      • time is the time to pose. The unit is seconds.
      • value is the transform value of the pose. When the property is position, it has 3 values (x, y, z), and when it is rotationQuaternion, it has 4 values (x, y, z, w).

Apply to animation

  • One frame corresponds to 3 positions and 4 quarternions.
    • The value of position corresponds to one keyframe per three in the order of x, y, and z. (unit is m)
    • The rotationQuaternion values correspond to one keyframe per 4 in the order of x, y, z, w.

  • In the above image, API output data is applied to the Animation component of the Pelvis bone of the Mannequin.glb model in the Babylon.js engine. (In accordance with the position unit cm of Babylon.js, the position value is multiplied by 100 each, and the Z value is adjusted according to the height of the character model)

  • Position and quaternion values must be applied according to the structure of the Animation component handled in the 3D engine used.

    Use case: Plask API response to Animation in Unity&iOS

How to import json file in Plask tool

  • Add the json file received as API output to the library of Plask tool.
  • Drag and drop the json file added to the library to the 3D model and import it as motion
  • Drag and drop the imported motion to the scene and check it by playing the animation.