Download

Can I associate an Animation Blue Print with any Actor, or does it have to be a Pawn?

I am attempting to build an actor that responds to input from a player controller, and executes animations based on the state of the actor (think cabinet that is closed, doing open animation and vice versa).
I have built the animations in Blender, and successfully imported them via FBX file as a skeletal mesh, with associated animations.

Through much experimentation, I’ve discovered the standard state machine implementation of an animation blueprint does not apply, because the animation is only executed on transition between states (Open, Closed). During the open and closed state, no animation should run.

My present approach is to use an animation blueprint and a simple montage. The montage has a single slot, and two sections. One section is open (with open animation) one for close. Each section has a completion notifier to trigger an action in the animation blueprint (change states from opening to open, closing to closed).

My problem comes when I want to create the blueprint for the cabinet itself. I add the skeletal mesh and a collision box to the blueprint. If I parent the BP to “Actor”, I can enable and disable input from the player controller fine. However, when I try to access the blueprint from the animation blueprint via a cast (to access it’s state variable), the compiler throws a warning that the cast will always fail because the parent is not a Pawn.

If I reparent the Blueprint from Actor to Pawn, I can no longer activate/deactivate input from the player controller.

So, can a blueprint parented to just Actor have an animation blueprint? The component is part of the scene, and wants to respond to player input, but it’s not really a pawn, because the player controller will never really “posses” it.

Any input or suggestions would be much appreciated.

AnimBPs are a property of a skeletal mesh component, they aren’t actually related to an actor in a specific way. Any place a skeletal mesh exists (on any actor) I believe you should be able to successfully use an AnimBP. I tested this just now by dragging a skeletal mesh directly into the world and assigning an AnimBP to it, and it seemed to work fine. I’d need to see your graph but I suspect you’re casting improperly.

On the other hand, If all you need is to play a single animation with no complex logic, why not bypass the AnimBP entirely? Set the skeletal mesh’s mode to just be “play animation” and just use simple BP calls to ask it to play whichever animation sequences you want. Functionally this is all you’re doing if your entire AnimBP does nothing but play a couple montages (I guess there’s some dynamic blending there, if dynamic blending is even something you want out of a cabinet object’s animations) but it’s much simpler. Whichever way you choose, though, should work just fine.