Impact Strength

Hi everyone,

I work in film industry as a sound editor and decided to learn FMOD and how it integrates with UE4 in my spare time.

So far it’s going okay-ish, the main deference for me is the fact in film you cut sounds to what you see on the screen but sound in games is 3D and operates differently, as it is triggered by different events and conditions.

So I created a first person template project in UE4 and started to work on it. So far, I’ve managed to add ambience sound, footsteps, slow and fast breaths and a gunshot sound.

Also, I’ve created various surfaces in my project and attached them to cubes, walls, floor. And I’ve attached different surfaces to the cubes. Then I’ve made impact events in FMOD with various impact sounds for different surfaces, e.g. Impact_Glass, Impact_Wood, Impact_Metal etc. Then I managed to setup “FirstPersonProjectile” blueprint in the way that every time the ball hit any surface, it plays correct surface impact sound, e.g. when I shoot in the cube with glass surface, it plays Impact_Glass sound. And as FMOD events have “Distance Attenuation” set up by default, the volume of the impact sound is louder or quieter depending on how far or close I’m to the object when the ball hits it.

However, I don’t want to use “Distance Attenuation” and instead, as the ball collides, account for how hard it’s impacting. So if I shoot from the distance the strength of the impact will be low but if I shoot standing next the an object, it will hit the object with max strength. Therefore the volume of the impact sound will be different, depending on the strength of the impact.

I’ve setup a parameter “Strength” in FMOD. Range is from 0 to 10. Setup volume automation, so at 0 it’s -70.0 dB and at 10 it’s +10dB.

Then I created a new float variable in Unreal, called “Strength” and set the value range from 0 to 10.

Then I connected “Play Event at Location” to “Event Instance Set Parameter” and “Value” of the “Event Instance Set Parameter” to “Strength” flow variable.

However, it doesn’t work as the the value of “Strength” doesn’t change automatically. Obviously, I did something wrong but at this stage I don’t really understand what exactly and as I only started with FMOD and UE4 last week, I don’t know how to solve the problem.

Can someone help please?

Maybe I’m overthinking? Maybe the best and simplest way to account for how hard it’s impacting as it collides is to use “Distance Attenuation”, so the further I’m from an object when the ball hits it the quieter the impact sound will be played and therefore it kind of says that the impact wasn’t heavy?

Thanks in advance for any help!

Broadly speaking, there are two types of parameter in FMOD: Built-in parameters, and user parameters.

“Built-in parameters” represent various aspects of the event instance that FMOD is able to automatically calculate based on the event emitter’s 3D position relative to the listener: Its speed, its distance from the listener, and so on.

However, there’s all sorts of information that can be important to a game or an event, but which aren’t included in the list of built-in parameters: The player character’s current health, which hat the player character is wearing, the number of coins remaining in the current level… Anything, really. For these properties, there are “user parameters.” A user parameter can represent anything you can imagine. However, because you can define them yourself, FMOD has no way of knowing what you intend them to represent, and so doesn’t know how to update them on its own; instead, you have to make your game set them to new values whenever you think it’s appropriate.

You’ve currently created your “Strength” parameter as a user parameter: You know what it means, but FMOD doesn’t, so to make it work, you’d have to make your blueprint automatically calculate the force of the impact, and update the value of the parameter accordingly. You can set the value of a parameter in Unreal by using a parameter sub-track, as described in our UE4 Integration User’s Guide.

However, in this case, there’s an easier option. The strength of an impact is based on the amount of momentum transferred by that impact, which is to say, it’s directly proportional to the momentum of the ball it hits. An object’s momentum is equal to its speed multiplied by its mass, and since the mass of the ball and wall are (presumably) constant and the wall is (presumably) stationary, you only need to care about the speed of the ball at the moment when it hits. As such, you should be able to get the results you want by changing your “Strength” parameter’s type to “Speed (Absolute)” so that the parameter value updates automatically, and setting the parameter to “Hold value during playback” so that the sudden change in speed from the impact doesn’t make the event change its behavior as soon as it starts. You can find both of these properties in FMOD Studio’s edit parameter dialog.

Hi Joseph,

Thanks for your reply!

I tried your method and it did work. However, I’ve noticed that I wasn’t able to control frequencies content if the type of parameter was set to “Speed (Absolute)”.

So what I did instead is set parameter’s type to “Built-In:Distance” and switched off distance attenuation on Master. Then I setup automation, so not only volume goes down depending on the distance of the impact but also low and high frequencies are being rolled of. It sound more natural to me this way.

Thanks for your help!