Animating FBX on trigger

Good day,

I have a small test animation as FBX done in blender. When I import the FBX file into UE4, it start animating by default but I don’t want that. I want it to animate only when I collide with a UE4 mesh.

Can anybody let me know how to do this?

Regards,

There are several ways to do this - you could setup an Animation Blueprint or go study how to use a Montage. These will be really handy once you start to add complexity. But let’s say you want to keep it super simple for right now.

At the most basic level, you’ll need some sort of collision object like a capsule or a box collision to detect impacts or overlaps with whatever you mean by “UE4 mesh”. Depending on how you have your collision on that component setup, you’ll either choose the OnComponentBeginOverlap event (like is shown below) for Overlap events or possibly a Hit event if you’re setup to Block those meshes instead.

You should probably test the Other Actor pin to see if it was a mesh you hit (as opposed to getting hit by a projectile or some other actor). Using a “Cast To” of whatever parent type you want to test is helpful there. Then just wire that result to a Play Animation function pulled off of your skeletal mesh. Put the animation you imported in the “New Anim to Play” dropdown. That’s it.

Note: If you do move this functionality over into a custom function in a custom AnimBP later down the road, the way to call that is to go from [Skeletal Mesh component] → Get Anim Instance → Cast To (your AnimBP class) → (call your function here)

(Image provided by Floxxman in the forums…)

https://forums.unrealengine.com/attachment.php?attachmentid=14527&d=1413639909