You could do this in 3 ways that I know of:
- If the animation is object-specific, bake the animation data on the object using animation software. Should give you great performance with the added features of Persona. Might take longer to do.
- If you’ve got this stored in a CSV file, you can import it into a ‘Data Table’](Data Driven Gameplay Elements in Unreal Engine | Unreal Engine 5.1 Documentation). It should be fairly straightforward to read from it and drive the object transform (Highly recommended)
- If converting to CSV is not an option, you can read from your file in C++ and drive the transform from there. Wouldn’t recommend it, since asset management will become slightly painful.
[/QUOTE]
So I was able to get this “working” a while ago for a project by using method 2 as you described. Now that I have newfound free time, I’m trying to clean up and generalize the implementation.
I accomplished the animation by using the ForLoopPerTick macro (found elsewhere on these forums), and on each tick I’m updating the world transform of the object based on the Data Table I created from the CSV file. This gives me some really smooth and clean animation after some small tuning. However, I can’t easily control the length of the animation. I know how long it should be from the state-history data, but I don’t know how to enforce that length.
I’m now experimenting using a Timeline and using the state-history data as “Curve Assets” on the timeline (i.e. these represent the actual x and y positions of my object over time from an external simulation). This way, the animation runs for the exact time I need it to. However, now the animations are super jerky and choppy.
I’m not sure how to solve these issues. The Timeline implementation seems the most intuitive and results in accurate time but choppy animation. The update-world-transform-per-tick implementation is a bit of mess to set up and control animation length but results in super smooth animation.
Any ideas?