How to Tie Animation Frames to Sound Playback

Hi, everyone!

I was wondering if anyone knows how to go about making e.g. a door that’s animated with a sound of the door opening and having the player control the animation. The question is, how to make it so that the sound is tied to the animation? If you open the door from frame 0 to frame 50 (out of a 100, for example), make it only play half the sound. If you close it back up, make it reverse the sound from 50 to 0 again. I hope that makes sense. I know how to play the sound fully but not how to make it more reactive to how much of the animation has been played. Is this even possible in Unreal Engine?

Thank you so much!

Bump

Hello, David!

In “vanilla” Unreal, no. Not that I’ve seen.

There may be functionality in METASOUNDS for Unreal, so I suggest you look up tutorials on how METASOUNDS works to disambiguate its limits and functionalities.

1 Like

Yes. We’ve done this on several projects. You can use SkeletalMesh SetPosition() function which sets the animation to an exact time:

USkeletalMeshComponent::SetPosition | Unreal Engine Documentation

So for example if the current animation on the skeletal mesh is 2 seconds long, and you called SetPosition(1.0, false) that would be the halfway position of the keyframe animation.

To do what you request would just be a matter of (1) start the sound effect, (2) interpolate the animation position during Tick(), and at some point (3) stop the sound effect and stop interpolating the animation position.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.