Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

Adding Animated Object into the World

Adding an animated object into Unigine is no harder than adding a simple static model. You just need to export an animated model from a 3D computer graphics software as a file (or files) of a Unigine-native format and then add it into the Unigine-powered project.

Animated object

The Adding Object into the World tutorial can be useful.

Prior Knowledge
It is supposed that you already have:

Notice
Within this tutorial, we are going to use art assets (an animated model and textures) available in Unigine SDK Browser.

Step 1. Export an Animated Model

An animated model can be exported into Unigine in one of the following ways:

  • As a single .mesh file storing model geometry and animation. This way of storing is good for simple objects as lift doors.
  • As separate files: a .mesh file to store model geometry and an .anim file to store its animation. This way is suitable for complex objects with a number of animations, such as a character that can walk, run, jump and so on.

Notice
Within this tutorial, we are going to export a model from Autodesk Maya. Exporting from Autodesk 3ds Max is also available.

1 Method: One File for Mesh and Animation

  1. In Autodesk Maya, open the animated model to be exported and select it.

  2. On the main menu, click File -> Export Selection....

  3. In the Export Selection window that opens, choose a folder to save the model and specify the mesh name. In the Files of type drop-down list, choose UnigineMesh.
    Notice
    We recommend you to save the exported mesh into the data/<project_name>/meshes/ folder.

  4. Specify parameters to export the animation: set the first and the last animation frame number in the Animation Range option, uncheck the Flip Y/Z Axes option, check the Export Skin Clusters option.

    Read more about export parameters in the Plugins for Maya article.

  5. Click Export Selection. The model and its animation will be saved in the specified file with the .mesh extension.

    You can check the result of the export in the Script Editor. On the main menu click Window -> General Editors -> Script Editor.

    The Script Editor window will open:

    Notice
    In case of any errors, open the Script Editor window to check error details.

2 Method: Separate Files for Mesh and Animation

  1. In Autodesk Maya, open the animated model to be exported and select it.

  2. On the main menu, click File -> Export Selection....

  3. In the Export Selection window that opens, choose a folder to save the model and specify the mesh name. In the Files of type drop-down list, choose UnigineMesh.
    Notice
    We recommend you to save the exported mesh into the data/<project_name>/meshes/ folder.

    Warning
    All filenames in Unigine are case sensitive! We recommend you to use lowercase for file names.
  4. In the File Type Specific Options tab with export options, specify parameters to export the skinned mesh:
    • To export only the bind pose of the model without animation, specify 0 in both fields.
    • Uncheck the Flip Y/Z option.
    • Check the Export Skin Clusters option.

    Read more about export parameters in the Plugins for Maya article.

  5. Click Export Selection.
    Notice
    You can check the result of the export in the Script Editor.
  6. Select the skinned mesh again to export animation of the model.
  7. On the main menu, click File -> Export Selection....

  8. In the Files of type drop-down list, choose UnigineMesh and specify a folder to save the animation.
    Notice
    We recommend you to save the exported mesh into the data/<project_name>/animations/ folder.
    Then specify a name of the file with the *.anim extension into which the animation will be exported. For example: marine_anim.anim.

    Notice
    You should add the .anim extension to the name of your animation file in the File name field to export animation in a separate file. Otherwise, it will be exported as the .mesh by default.
  9. Specify parameters to export the animation. The export options must be the same as above, except the Animation Range option. You should set here the first and the last animation frame number.

  10. Click Export Selection. The animation of the model will be saved in the specified .anim file.

Step 2. Add Skinned Mesh into the World

  1. Run the project with the loaded editor via the SDK Browser.

  2. On the Menu bar, click Create and choose Object -> Mesh Skinned.

  3. In the file dialog that opens, choose the skinned mesh file that you have exported from Autodesk Maya. It can be both with animation or without.

    The model will appear in gray as it uses a default material mesh_base.

  4. Click Windows -> Nodes or press N to open the Nodes window.

  5. Choose the added node and open the MeshSkinned tab. If the .mesh file was exported separately with .anim file, then click Load animation, otherwise, go to the step 7.

  6. In the file dialog that opens, choose the .anim file that you have exported from Autodesk Maya.

  7. Loop the animation and press Play.

Notice
Then you can also assign materials to the mesh as described here.
Last update: 2017-07-03