I’m trying to set up a material check system for the footsteps. Triggered by an “AnimNotify” on the animation timeline, I perform a LineTrace whenever a footstep takes place to check the surface type. Based on the result a “Play Event Attached” function is triggered to play the sound. The system is working so far, but I have to use one event for each surface within FMOD.
I’d like to switch between the different sounds using a parameter change. Unfortunately I can’t get this to work, as I can’t add a FMOD audio component to the animation blueprint and have therefore no event to reference as my target for the “Set Parameter” function.
Any ideas how I can work with parameters within the animation blueprint?
The blueprint we ship with our integration ‘AnimNotify_FMODPlayEvent’ won’t work with parameters because it uses an FMODEvent object rather than an FMODAudioComponent.
You are free to edit the blueprint, or copy it to make your own custom AnimNotify to suit your needs.
To open it you will need to change the ‘View Options’ in the Content Browser window to show plugin content. Then navigate to the ‘FMODStudio Content’ folder and you will see the AnimNotify_FMODPlayEvent blueprint. From there you can replace the FMODEvent with an FMODAudioComponent and use the SetParameter node.
You can adapt this solution so that it works with the FMOD Events and FMOD Set Parameter!
I am using this line trace blueprint always and it works fine. You just need the blueprint and the physical materials.
Here’s a solution that uses a custom AnimNotify Blueprint, and isn’t dependent on the animation blueprint or other classes:
Setup SurfaceTypes in ProjectSettings
Create Blueprint class based on AnimNotify named FootstepNotify
In ReceivedNotify of the Blueprint, perform the line trace against visibility, get surface type, play event at location (with AutoPlay disabled), set surface type parameter on the event, then play the event (See blueprint graph below)
In FMOD, use a single event with one parameter called SurfaceType, and place MultiInstruments on the SurfaceType timeline (not on the main timeline), at each integer value (0, 1, 2, …) that match the SurfaceTypes you defined in ProjectSettings (the Celeste demo project from FMODs site has an example of this setup)
Note that the example graph plays sound at the owning actors location (center of body), our game is top-down so precision of where the sound is coming from didn’t matter, might want to change that to the hit location if its a 1st or 3rd person game with closer camera.