# FMOD and Floating Origin

**URL:** <https://qa.fmod.com/t/fmod-and-floating-origin/16412>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [November 9, 2020, 12:27pm UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412 "2020-11-09T12:27:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LenneR](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@LenneR](https://qa.fmod.com/u/LenneR)\
**Post date:** [November 9, 2020, 12:27pm UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/1 "2020-11-09T12:27:17Z")

</div>

Hi,

We have a floating origin in our game, meaning that from time to time our whole world will shift back to center. There is a chance that nearby sounds are playing when this happens. Often we use RuntimeManager.AttachInstanceToGameObject and this should be no problem since those gameobjects will be moved by our origin shifter. However when we use RuntimeManager.PlayOneShot with a position I think we will start seeing issues. Is there a way to update all positions of the active one shots that are attached?

Alternatively, would it be an option to attach all oneshots to a gameobject that we will shift and use a localposition to place the oneshots in world space?

Thanks!

---

<div class="post-metadata">

**Author:** ![cosmochristo](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@cosmochristo](https://qa.fmod.com/u/cosmochristo)\
**Post date:** [November 11, 2020, 3:49am UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/2 "2020-11-11T03:49:32Z")

</div>

Hi @LenneR,  
I know this is not a direct help but this kind of audio glitch is one of the reasons not to use origin-shifting form of floating origin.  
I use (standard) audio in Unity with continuous floating origin and the glitches, graphical, audio, etc, don’t exist.  
best of luck with the game.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [November 17, 2020, 5:34am UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/3 "2020-11-17T05:34:19Z")

</div>

Are you able to use `RuntimeManager.PlayOneShotAttached` instead?

---

<div class="post-metadata">

**Author:** ![LenneR](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@LenneR](https://qa.fmod.com/u/LenneR)\
**Post date:** [November 24, 2020, 10:23pm UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/4 "2020-11-24T22:23:24Z")

</div>

Theoretically that’s possible yeah. But sometimes there is no logical gameobject to attach it to. However if there would be an option to set localposition when PlayOneShotAttached is used (as an optional parameter) this would be really nice. Because then I could simply attach it to my center world object and it would simply move when the origin shifts.

---

<div class="post-metadata">

**Author:** ![LenneR](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@LenneR](https://qa.fmod.com/u/LenneR)\
**Post date:** [November 24, 2020, 10:24pm UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/5 "2020-11-24T22:24:48Z")

</div>

Thanks for you response, but this is not a viable option for us.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [November 25, 2020, 9:50pm UTC](https://qa.fmod.com/t/fmod-and-floating-origin/16412/6 "2020-11-25T21:50:08Z")

</div>

At this time the integration only updates the positions of events that have been attached to objects, and `PlayOneShot` is not intended to be used on events that require their position to be updated.

You could create an empty gameobject at a required position and attach the event to that.  
Otherwise you could do it manually:

```auto
FMOD.Studio.EventInstance eventInst = FMODUnity.RuntimeManager.CreateInstance("");
eventInst.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Transform/Vector3));
eventInst.start();

```

Then use the `set3DAttributes` to update the position as required.
