Unreal Engine Animation Slots


I want to setup a montage with 2 slots, one fullbody one upper body. I have a section overlapping both, first animation is on fullbody, the second is on upperbody and looping. I cannot get the upperbody animation to play, they are still playing on fullbody even if there is not animation in the fullbody slot. Hi all, I've been using Unreal for a while but I'm just now getting into animation blueprints and I'm trying to figure out the best way to handle this weapons system. Here is my current state machine for weapons, which gets blended with the character movement. The problem is, I'm planning to have about 10 weapons slots, with multiple weapons.

Unreal engine animation slots free play

This is a project i created during my 2018 winter break. The project is created in unreal engine using C++. I worked closely with my friend, Nicholas Chmil. You can find his breakdown here. I was responsible for creating the inventory, while Nicholas(not me) handled the animation blueprints and adding in content from the unreal store. Everything is properly replicated, so multiple players can share items and manage weaponry together.


Each item has a constant presence in the world, and can be dropped or thrown at will. Ammunition can be stacked and unstacked with the right and left mouse buttons.

The Breakdown:

As Stated before, each item has a constant presence in the world. Items in the inventory are rarely spawned or destroyed (only when separating stacks and applying attachments). I did this to keep the actual inventory simple. It is just an array of structs,which include: a pointer to the item in the world, a boolean to determine weather or not this slot is full, and an integer to reference the array index of this slots parent.
The parent slot is used for items that are larger than one slot, for instance if i were to drag the shotgun into slot 0, slots 0 through 4 would have slot 0 as their parent. This works on both the x and y axis. As you can see in the GIF above, the ar4 takes up a 4x4 slot.
The item actors (which firearm actors inherit) holds all the information for the item. Ranging from the animations for the item to the size it takes up in inventory. The most interesting variable held by the item actor is its stack size. This makes it so you can drop an entire stack of items as one item. When items are unstacked, a new actor is spawned into the world. Below is the inventory category for items.
The full item header can be found Here
and the firearm class can be found Here
The complex inventory component holds the major functions called by the player and ui.
The most interesting feature is the ignoreslot argument additemtoslot function. This makes it so the player can add an item to a slot even if it overlaps its previous slot (you can see this happening with the ar4 in the GIF above). I do this because the item is not removed from a slot before it is added to a new slot. If you would like more info on how the complex inventory works, you can check out the breakdown i did on a complex inventory in unity Here

This is the blueprint responsible for when a drop is detected on an inventory slot. First i cast to my custom drag and drop object, which holds information about the item like the slot it came from and its aitem pointer. i then branch off if it is splitting a stack because i need to preform special operations when splitting like creating a new actor in the world. After that it is as simple as removing the item from the slot, checking to see if it fits into the new slot, and if it doesn't we just re add it to the old slot.
Full Image

Below is the full code for the character and the inventory component.
Unreal engine animation slots no deposit


Tunics Character.cpp

For my thesis film, “Buds”, I used an experimental feature for Unreal Engine 4 called “Geometry Cache” to import animation. These geometry cache actors can be used when you import an alembic cache file (.abc). In this post, I will briefly talk about my experience using alembic files with UE4.

At the time of writing this, UE4.16 has just been released, and the majority of the film was made using 4.15 or previous versions. While Geometry Cache actors may be fully implemented in future engine versions, the following steps I took to bring in animation from Maya to UE4 using alembic cache will be based on UE4.15.

Using this alembic cache pipeline in the current experimental state is honestly not recommended but doable. I only resulted in using this method due to the way my character rigs were set up, and based on the fact that early small scale tests turned out successful.

Unreal Engine Animation Slots 777

As an experimental feature, importing alembic cache files may sometimes not be perfect in terms of bringing in animation, geometry, etc information into UE4, even though the cache files read perfectly fine in Maya. Some of the animation or geometry may be missing/broken etc. In this case, you can try using different settings, re-import/exporting, etc. with varying results.

Unreal Engine Animation Slots Free Play

Most of my explanation and steps I took below are from my own testing, trial and error, online research, and luck. Results may vary, especially it being a work in progress for both me using and learning UE4, and geometry cache being implemented into the engine.

Anyway, this is how I managed to get alembic cache files working in Unreal Engine 4 for animation:


Free

Exporting Alembic files (.abc) from Maya:

  • Select ONLY your geometry - Cache - Alembic Cache - Export Selection to Alembic - make sure ‘UV Write’ in the option box is selected, and the file format be set to ‘HDF5’.
    • You can select as many pieces of geometry as you would like for one alembic export file, but the more you select, the larger the file sizes become, and due to the large file size nature of alembic cache, you should group certain geometry together and bring in geometry in sets to reduce risk of data loss/corruption during the cache phase.
    • From my testing, some extra options may need to be checked for accurate geometry and animation information. This result will vary depending on the situation. I have personally checked ‘Write Face Sets’, ‘World Space’, ‘Renderable Only’, ‘Write Visibility’ and ‘Strip Namespaces’ in addition to ‘UV Write’.
    • Unlike importing .fbx files, selecting multiple geometry and exporting them as one alembic file retains its separate geometry information when brought to UE4.
  • Be sure to have your animation exports ALWAYS start at frame 1, and keep the frame range exported under ~500 frames for best results. Going over ~500 frames and/or exporting animation that does not start at frame 1 per alembic cache have resulted in loss of animation information.
    • The fact that animations must start at frame 1 was a realization made after tedious trial and error and pure luck. I have actually posted this on the Unreal Engine Answer Hub and Matt Williams from Epic Games made an official bud report regarding it. You can find my original question posted here: https://answers.unrealengine.com/questions/584143/alembic-cache-import-missing-frames.html and the bug report here: https://issues.unrealengine.com/issue/UE-43973

Importing Alembic files into UE4:

  • There are three types of import options you can chose from: Static Mesh, Geometry Cache, and Skeletal. Select Geometry Cache.
    • CHECK ‘Force One Smoothing Group Per Object’, ‘Recompute Normals’, and UNCHECK ‘Ignore Degenerate Triangles’ while in the import options.
  • Once imported and brought into the scene, set the translate to 0, rotate the object by 90 degrees in the X direction, and make sure to check the ‘Running’ option in its Details section for the animation to start playing once you click ‘Play’.
    • I have noticed that UE4 has a very high tendency to crash upon loading the level if you save the level with geometry cache actors present in the scene. So far, the only way to fix this issue that I have found is to navigate through your UE4 project files, and delete the imported alembic cache files from the project all together, so that they are not present when you load the level. Although this makes it tedious having to re-import your alembic cache files every time you want to come back to a certain level, at least it is a doable workaround.
  • Shaders can be applied to the geometry cache actor similar to static mesh actors. As long as the separate material IDs were applied in Maya before exporting the alembic cache, the geometry cache actor should retain all the separate material slots for you to use.

As a bonus, here’s importing cameras from Maya to UE4:

  • In Maya, select the camera and chose the ‘Game Exporter’ option under ‘File’.
  • Under the ‘Animation Clips’ tab, change to ‘Export Selection’, add the frame range of animation you want to export for the camera, check ‘Bake Animation’, have the ‘Up Axis’ be ‘Y’, and ‘FBX Version’ as ‘FBX 2014/2015’.
  • In UE4, create an Empty Actor, place it at the origin, and rotate it by 90.-90.0.
  • Create a Cine Camera Actor, and place it under the Empty Actor in the World Outliner (the axis that the empty actor need to be rotated by either 90 or -90 may differ, but it should be easy enough for you to figure it out on your own if this is the case. Just look through the Cine Camera and rotate the empty actor until you see the right image!).
  • In the sequencer, drag the Cine Camera Actor into the timeline, right mouse click on the ‘CineCameraActor(#)’ and click ‘Import’
  • Select the exported camera .fbx file.
Slots


Again, all this was from my own testing, trial and error, and from bits of information that I was able to find online. It is not perfect, and some may just be plain wrong, but it worked for me for my film. If you have any questions, suggestions, or comments, please let me know! I also have a full Google Docs write up of what to do and expect when going from a pure Maya pipeline to using UE4 for rendering that goes beyond animation and alembic cache. If you would like to check it out, let me know and I’ll shoot you the link!

Unreal Engine Animation Slots No Deposit

You can visit me at http://www.jameshyun.com/ and contact me at junyoung1861@gmail.com