# FMOD 3D PANNER

**URL:** <https://qa.fmod.com/t/fmod-3d-panner/12575>\
**Category:** FMOD Engine\
**Created:** [July 7, 2016, 7:48am UTC](https://qa.fmod.com/t/fmod-3d-panner/12575 "2016-07-07T07:48:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hackeas](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hackeas](https://qa.fmod.com/u/hackeas)\
**Post date:** [July 7, 2016, 7:48am UTC](https://qa.fmod.com/t/fmod-3d-panner/12575/1 "2016-07-07T07:48:25Z")

</div>

hello, when i erase the 3d the sound is ok, but when i put tthe 3d panner, there is no sound, why?

![enter image description here](http://i64.tinypic.com/vq49x0.png)

run the code and the sound is ok! but…

![enter image description here](http://i65.tinypic.com/f4pkeh.png)

![enter image description here](http://i65.tinypic.com/15pibr8.png)

no sound! when the player moves until the 3d space ☹  
even when the enemy is not moving. and whe i assign a built in distance parameter.

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [July 8, 2016, 5:32am UTC](https://qa.fmod.com/t/fmod-3d-panner/12575/2 "2016-07-08T05:32:48Z")

</div>

> [@](#):
>
> hello, when i erase the 3d the sound is ok, but when i put tthe 3d panner, there is no sound, why?
> 
> ![enter image description here](http://i64.tinypic.com/vq49x0.png)
> 
> run the code and the sound is ok! but…
> 
> ![enter image description here](http://i65.tinypic.com/f4pkeh.png)
> 
> ![enter image description here](http://i65.tinypic.com/15pibr8.png)
> 
> no sound! when the player moves until the 3d space ☹  
> even when the enemy is not moving. and whe i assign a built in distance parameter.

By default, our unity integration attaches the listener to the camera. Your game seems to use third-person perspective; If you want the audibility of events to be based on the player’s position, you need to attach the listener to the player. Have you done this?

---

<div class="post-metadata">

**Author:** ![hackeas](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hackeas](https://qa.fmod.com/u/hackeas)\
**Post date:** [July 9, 2016, 1:58am UTC](https://qa.fmod.com/t/fmod-3d-panner/12575/3 "2016-07-09T01:58:30Z")

</div>

Yes! that is the solution! it works. thank you Joseph Harvey.

but i have another problem, that work if a have the sound in a Studio Event Emitter, but when i use the script something missing, maybe activate the 3d panner in the script, but how?

the script

using UnityEngine;  
using System.Collections;

public class EnemyMovement : MonoBehaviour  
{  
Transform player;  
PlayerHealth playerHealth;  
EnemyHealth enemyHealth;  
NavMeshAgent nav;

```
[FMODUnity.EventRef]
public string Playerstate2 = "event:/Music";

void Awake ()
{
    player = GameObject.FindGameObjectWithTag ("Player").transform;
    playerHealth = player.GetComponent <PlayerHealth> ();
    enemyHealth = GetComponent <EnemyHealth> ();
    nav = GetComponent <NavMeshAgent> ();
}

void Update ()
{

	FMODUnity.RuntimeManager.PlayOneShot (Playerstate2 );
    if(enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
    {
        nav.SetDestination (player.position);
    }
    else
    {
        nav.enabled = false;
    }
}

```

}

if i use the 3d panner not work , only in the studio event emmiter. if i erase the 3d panner doesn´t sound.

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [July 12, 2016, 2:04am UTC](https://qa.fmod.com/t/fmod-3d-panner/12575/4 "2016-07-12T02:04:17Z")

</div>

> [@](#):
>
> Yes! that is the solution! it works. thank you Joseph Harvey.
> 
> but i have another problem, that work if a have the sound in a Studio Event Emitter, but when i use the script something missing, maybe activate the 3d panner in the script, but how?
> 
> the script
> 
> using UnityEngine;  
> using System.Collections;
> 
> public class EnemyMovement : MonoBehaviour  
> {  
> Transform player;  
> PlayerHealth playerHealth;  
> EnemyHealth enemyHealth;  
> NavMeshAgent nav;
> 
> ```
> [FMODUnity.EventRef]
> public string Playerstate2 = "event:/Music";
> 
> void Awake ()
> {
> player = GameObject.FindGameObjectWithTag ("Player").transform;
> playerHealth = player.GetComponent <PlayerHealth> ();
> enemyHealth = GetComponent <EnemyHealth> ();
> nav = GetComponent <NavMeshAgent> ();
> }
> 
> void Update ()
> {
> 
> FMODUnity.RuntimeManager.PlayOneShot (Playerstate2 );
> if(enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
> {
> nav.SetDestination (player.position);
> }
> else
> {
> nav.enabled = false;
> }
> }
> 
> ```
> 
> }
> 
> if i use the 3d panner not work , only in the studio event emmiter. if i erase the 3d panner doesn´t sound.

Use

FMODUnity.RuntimeManager.PlayOneShot(Playerstate2, transform.position);

to play the sound at the objects current location.

Use

FMODUnity.RuntimeManager.PlayOneShot(Playerstate2, gameObject);

to have the sound follow the game object position for the duration of the event.
