How to set up an FMOD event to get a hitting sfx when the play shoots at an object in Unity?

Hi there,

I’ve been getting my head around integrating FMOD into Unity3D over the last few weeks, and I have hit a bit of a wall with the FMOD’s tutorial Survival Shooter. I’m only just getting used to scripting, so please excuse me if I use the wrong terminology!

I want to create an event where the player shoots at an object (car), and I get the impact of the bullet hitting the car. I created a 3D empty object, and I attached it to the object (car). I then checked the 'Is Trigger" on the Box Collider component.

After I add an FMOD Studio Parameter trigger and I select the player prefab. The player had already an FMOD Event Emitter attached to it. I did use the player to check whether the trigger works. It did work.

However, I do not know how to set up the bullet or the gun as a trigger to get the hit sfx.

Does anyone know if I can find a solution?

Thanks in advance.

Chris

In Unity, for a collider component to detect a collision, the thing it’s colliding with must also be a collider. Does the bullet have a collider component?

Hi @joseph,

Many thanks for your prompt reply.

I am not sure if you are familiar with the Survival Shooter game (Unity Learn), but there is a rendered line instead of bullets.

So whenever I use the player or the gun itself as a trigger point to enter the trigger zone or going close to the object, I get the bullet sfx. However, when I try to shoot at the car, it does not work. So I do not know what I am doing wrong, as it looks that the trigger works, but it does not work in the way I want it.

Does that make any sense?

Kind regards,

Chris

I’m not personally familiar with the Survival Shooter game, but perhaps you could detect when the raycast of the gunshot is touches the car, and then play a “car getting hit” event at that location?

This question isn’t really about FMOD… If you’re having trouble understanding how to detect collisions in Unity, perhaps it would be best to ask on a Unity forum?

I will try to post it on the Unity forum too.

Thanks for your help.