# My fmod 3d listener works but I have a problem

**URL:** https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465
**Category:** FMOD Engine
**Tags:** cpp
**Created:** [March 4, 2022, 4:18pm UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465 "2022-03-04T16:18:46Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![LQalez](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@LQalez](https://qa.fmod.com/u/LQalez)
#### Post date: [March 4, 2022, 4:18pm UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/1 "2022-03-04T16:18:46Z")

</div>

![9B0076E07071495C84BAF061F17B7700](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/b/b73477d2c111c5c7be80c0ac7dd6b263bd93e649.png)  
This is my repetitive code

I guess my problem is understandable in this video (I can get the left, right, front, back vector values ​​of my camera.

> **[mp4: 2022-03-03 18-37-50.mp4](https://files.fm/u/shm3p7a5v#/view/tpmkaz7ca)**
>
> Visit this link to play the video: 2022-03-03 18-37-50.mp4

Let me tell you, if I look behind my camera, the sound continues to come from the right instead of from the left.

---

<div class="post-metadata">

### Author: ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)
#### Post date: [March 9, 2022, 5:55am UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/2 "2022-03-09T05:55:45Z")

</div>

Looks like this is because you aren’t setting the correct rotation- you are passing forward and up vectors of [0 0 1] and [0 1 0] which will mean the listener is always pointing globally forwards.  
To correct this you will need to get your camera rotation, and from there calculate forward and up vectors. There are a few different ways to calculate them depending on what you get back from the camera’s rotation- what game engine / geometry library are you using?

---

<div class="post-metadata">

### Author: ![LQalez](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@LQalez](https://qa.fmod.com/u/LQalez)
#### Post date: [March 9, 2022, 5:41pm UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/3 "2022-03-09T17:41:57Z")

</div>

my Engine, DirectXMath

---

<div class="post-metadata">

### Author: ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)
#### Post date: [March 10, 2022, 3:43am UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/4 "2022-03-10T03:43:25Z")

</div>

Ok, well as far as I know that doesn’t have a camera class so I’ll assume that is your own creation? Do you have something in there like `GetForwardVector()` or `GetLeftVector()`?

---

<div class="post-metadata">

### Author: ![LQalez](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@LQalez](https://qa.fmod.com/u/LQalez)
#### Post date: [March 10, 2022, 6:54am UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/5 "2022-03-10T06:54:12Z")

</div>

> [@jeff\_fmod](#):
>
> Ok, well as far as I know that doesn’t have a camera class so I’ll assume that is your own creation? Do you have something in there like

I specified in my problem I can get my right, left, front and back values

---

<div class="post-metadata">

### Author: ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)
#### Post date: [March 10, 2022, 10:24pm UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/6 "2022-03-10T22:24:34Z")

</div>

So you did- in which case, you need to convert your camera’s front and up vectors to `FMOD_VECTOR` and call `System::set3DListenerAttributes` witth those instead of [0 0 1] and [0 1 0].

---

<div class="post-metadata">

### Author: ![LQalez](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@LQalez](https://qa.fmod.com/u/LQalez)
#### Post date: [March 11, 2022, 6:55pm UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/7 "2022-03-11T18:55:55Z")

</div>

can you give an example?

---

<div class="post-metadata">

### Author: ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)
#### Post date: [March 16, 2022, 3:44am UTC](https://qa.fmod.com/t/my-fmod-3d-listener-works-but-i-have-a-problem/18465/8 "2022-03-16T03:44:09Z")

</div>

Again, without knowing what your Camera class provides or your geometry’s handedness this might not be 100% correct, but I would expect something like this to fix the issue:

```auto
FMOD_VECTOR forward = { d3d.camera3D.GetForward().x, d3d.camera3D.GetForward().y, d3d.camera3D.GetForward().z};
FMOD_VECTOR up = { d3d.camera3D.GetUp().x, d3d.camera3D.GetUp().y, d3d.camera3D.GetUp().z};
FMOD_VECTOR vel = { 0.f, 0.f, 0.f };
system->set3DListenerAttributes(0, &listenerpos, &vel, &forward, &up);

```
