Animations - MassiveMiniteam/OddModKit GitHub Wiki

Static Mesh Animation

Blender Setup

Blender Frame settings

  • Make sure the scene is set up with the correct settings: Starting at frame 0 and 30fps
  • We animate the meshes directly in Object Mode in Blender
  • All objects that will be exported need the prefix “S_” → “S_Logic_BufferGate_Platform”
  • You can set up a hierarchy of different meshes in Blender, make sure to
    • Parent: Object (Keep Transform Without Inverse)

    • Important: If the pivot is not at the origin you need to create Empty objects at the origin of the child object and put these between the animated object and its parent, so that the location and rotation are zeroed out.

      • Make sure to parent as above with “Object (Keep Transform Without Inverse)”
      • Also make sure to give the empties proper names, so it’s easier to manage the file

Creating Animations

  • The animation for each object needs to be the same length

    • So even if a part only moves at the end of the animation, you should add a keyframe on the first frame
  • Give the Action that is created a meaningful name

    • Best practice is to use the object name and a suffix that describes the animation
  • Once you’re done, press “Push Down” to add the Action to the NLA Editor

    • You can reassign the animation to the object afterwards to edit it. No need to “Push Down” again

Export using scripts

  1. mmt_staticMesh_Export
    • Make sure an Export folder is set up either in the same directory or above
    • Select all parts of the mesh, load the script into Blenders “Scripting” view and run the script
    • If the script is already loaded and shows a red question mark, unlink and reload the script again
    • The parts will be moved to the origin and exported individually with their names as filenames into the Export folder
    • Make sure to give the parts proper names, starting with “S_”
  2. mmt_animation_export
    • Double check that the animations are visible in the NLA Editor
    • Select all parts that you have animated
    • Load the script into the “Scripting” view and run it
    • The parts will be exported into the Export folder with the same name as the part, replacing the “S_”-prefix with “A_”

Export without scripts

The following is covered by the mmt_staticMesh_Export and mmt_animation_export scripts, if you decide not to use them make sure to follow these steps

  • Before exporting move the mesh to the origin to preserve the pivot
    • Otherwise the pivot will be offset after importing it to Unreal
    • On a technical level it won’t make any difference for the animation curve, but for preview purposes it’s better to move the object
  • If you set up a hierarchy in Blender, unparent the objects before export or you will get multiple clips per object
    • For example you have a Saw parented under Building
    • The Building jumps up and down, the Saw has its own rotation animation
    • If these stay parented during export and import both animation tracks will be applied to both object and you’ll have to delete the unnecessary clips in Unreal
  • Blender Export settings
  • Make sure to export every object separately
  • If the static mesh is not in Unreal yet, please also export the individual meshes without animations
  • Make sure to give every file an appropriate name
    • “S_”-prefix for all static meshes
    • “A_”-prefix for all animations

Import to Unreal

  • Create a new folder called “Meshes”
    • Import the static meshes (files starting with “S_”)
  • Add all meshes to the blueprint
    • Set the hierarchy up the same way you set it up as in Blender
      • If “S_Lid” was a child of “S_Platform” in Blender it needs to be a child in Unreal as well
    • After setting up the hierarchy, position the items using the values from Blender
      • Location: X = X100, Y = Y-100, Z = Z*100
      • Rotation: X = X, Y = -Y, Z = Z
      • If you used Empties as a buffer, use those values, as the location on the object itself should be 0 in this case
  • Create a new folder called “Animations”
    • Import the animations (files starting with “A_”)
    • Make sure to switch on Preserve Local Transform in the import settings
  • Unreal will create animation clips and skeletal meshes
  • To keep things clean you can move the skeletal meshes, skeletons and physics assets into a folder “Skeletal Meshes” within the animation folder
    • These objects are only necessary to preview the animation, but not for anything else

Animation Curves

  • Right-Click in the content browser, Miscellaneous —> Data Asset, create a “StaticMeshAnimationContainer”
    • Give it an appropriate name, e.g. “AC_Loom_Active”
  • From the Lord of Construction menu select “Open Animation Importer”
  • Click on the StaticMesh Importer tab
  • Select your Animation Sequence
  • If no animation Montage has been created yet you’ll be prompted to create one
  • Add the previously created Animation container to the “Static Mesh Anim Container” Slot
  • Make sure the track name is correct: This is the mesh’s name from your blender file
    • It also needs to be the same name of the mesh inside the Blueprint (see below)
  • Click “Update Static Mesh Animation”

Blueprint Setup

  • Check that the meshes in the Blueprint are all correctly named and positioned, as described before
    • As mentioned before, make sure the name of the mesh is the same name as the animation track
  • In the Components tab select “AnimationPresentation” and continue on the Details Tab
    • Under “Animation Presentation Component”, “Animation Container Mappings” add a new element
    • Choose “isCrafting” under tag and add the previously created animation container
    • "isCrafting" is the only animation that Workstations will play by default. Any other animation tag will have to be triggered by hand with the Animation Presentation component's "Play Animation with Tag" function and stopped with the "Stop Animation with Tag" function. image