Camera Zoom Sound Blueprint in FPS Template

Hi everyone!
I’m an Unreal Engine beginner, so apologies if this is a basic question—I’m still learning the ropes.

I’m using the FPS blueprint, and I want to implement a zoom mechanic where the player can zoom in and out using the right mouse button (RMB). Pressing RMB should trigger a “camera zoom” sound while the camera zooms in, and releasing RMB should play a “zoom out” sound while the camera returns to its original FOV. The zooming animation takes 3 seconds in both directions.

Here’s the problem:
If I press and release RMB quickly (e.g., within 1 second), the “zoom out” sound still plays in its entirety, even though the zoom animation has already finished.

Questions:

  1. How can I adjust my blueprint to stop the “zoom out” sound when the animation ended?
  2. (Optional) Is it possible to sync the sound with the animation? For example, if the zoom-in animation reaches 20% and I release RMB, can the zoom-out sound start from a point corresponding to that animation progress (e.g., at -20%)?

I’ve attached my current blueprint setup for reference. Any guidance would be greatly appreciated. Thank you!

Hey @hanneshu!

You can use the return value from the sound spawns, and use “Set Active” nodes to deactivate them with a false bool. Also, you want to make sure they Auto Destroy or you’ll end up with a ton of them stacking up. :slight_smile:

Then you can either use an event from the timeline to do the stopping or check for thresholds on the float to end the sound.
Hope this helps!

1 Like

Hey @Mind-Brain! Thanks for helping me out! Set Active worked perfectly, Yassss!
Here’s the blueprint in case someone else has a similar question :slight_smile:

Edit: Okay, I ran into a small issue—everything works fine, but when the timeline plays in its entirety, I get this error:

Blueprint Runtime Error: “Accessed None trying to read property CallFunc_SpawnSound2D_ReturnValue_1”. Node: Set Active Graph: EventGraph Function: Execute Ubergraph BP First Person Character Blueprint: BP_FirstPersonCharacter

1 Like

My first thought would be that the Timeline is longer than the sound! If this is the case, and it’s auto destroyed, it will destroy the sound before the timeline can set it active or not. You can use an “IsValid” check to make sure to get rid of that error!