Download

Generic State Machines - Possible?

Hi everyone!

I have some experience with Unreal but I am very new to the animation stuff.

I am creating a super-simple animation state machine for a chest that can be opened by the player.

It starts playing the Idle sequence (loop), when player opens the chest it plays the Opening sequence and when it’s finished, the Open sequence starts playing (loop). If game is loaded from a save and the chest is already open then the Open sequence plays from the start.

It’s super simple. So my question is:

Is it possible to make this BP generic, so that it can be re-used for any container that uses the same logic? Ideally I would like to have a simple blueprint that has 3 properties for Idle/Opening/Open sequences and that can be used with any skeletal mesh and any skeleton.

I am open to any kind of advice including those involving Blueprint or C++.

~Robert.

if all containers share the same skeleton, yes.
however since a game could have several chests, Im not sure a skeletal mesh is the way to go for such a simple operation.

nonetheless.
If you do use skeletal, add a couple of bones to the lid as guides for where the character hands should be.

Each animation will have to be rerargeted to the different skeleton if you make skeletal alterations - so if the lid is smaller, the hand bone gets moved, or the skeletal structure changes any other way.
Which is a good reason Not to use a skeletal mesh given a chest could be just about any size/shape.

Regardless. If you share the same skeleton on all, then the same BP can be used on all of them.
if you modify the skeleton, then you need to retarded the animBP and assign it to the specific changed asset.

If you set the template up (an actor bp) with a single constraint and 2 static meshes plus an arrow atrached to the lid or something similar to simulate and attach the player hand to for animation you may have an easier time.
the lid is often pivoting in just one rotational axis, so it is super simple to animate it with a timeline.
And its even possible to detect the character, with an interface, and pull the value of a curve for When the chest should open.
its a bit more complex in setup, but I think it way more extendable than animations.