How do I rotate the Audio relative to a listerner object.

0 favourites
  • 7 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi, currently iam working on a fps game. The audio design in constrcut is realtivly streight forward, if the player is left of a sound source i hear the sound from the right speaker and vice versa. But how can i make it relative to the player angle? for example if the player looks down the chanels should be switched, as left is now right and right is now left.

    In an old post i read, that the sound is rotated with the layer, so i did the following experiment:

    which unfortunatly did not work. Do the sound sources also have to be on this layer?

    my last resort would be to reduce the volume by distance to the player, which would be a somewhat unsatisfying solution for an FPS :(

    Kind regards

    Joschi

    Tagged:

  • So i realised i can calculate the position of the sound somehow. because, i know xy of the player, the looking angle, and xy of the sound source. So with this i should be able to calculate the same position of the sound based on the player angle... I am sure it has something to do with cos and sin but shool was long ago :D Any help on this? :D

    How does the engine actually handle position changes, so what if the player moves or turns arround while the sound is playing? lets say there is a looong zombie moan, i think when the player moves it changes position while moving, but when the player turns, it should not change position, correct? That might be another porblem. I am thankfull for any suggestions, but according to the missing feedback it might just not be possible with constrcut just yet to do it correctly? After all the 3D features are quite new :(

    Something like this might be correct...

    Edit: Solution by newt from discord:

    just reverse the direction and you should get the right sound position:

    visualized result:

    gyazo.com/d77774aa40b01f6b76885747d459fd53

  • I ralized this only works if the player is left oft the object, if he is right of the object you have to subtract 270degrees, but it still sounds of with above and below. It patitially works correct now, but my thinking must be still somewhat wrong. Does any one have an idea how to solve this? There must be a solution in playing sounds relative to the player? Am i missing something?

    Kind regards

  • So here are my newest findings, i still cant get a formular from this logic tho :( why i am bad at math? XD somehow one have to do an angle correction depending on the player position relative to the sound object.

    So if one uses this formular:

    x+cos(angle)*distance, y +sin (angle) *distance you can take the looking angle and correct it by:

    if source is on the right side its +90

    if sound source is below its +360

    if soud source is on the left side its +270

    if sound source is above its +180

    i am actually doing this by tryial and error, and i still havent figured out what if the source of the sound is for example on the top right of the player... I am sure there is a way to calculate this... Even better would be if someone of the construct team could confirm that there is an intended way to do this or at least that there is something in the making? :D

    Kind regards

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nice solution, thanks :)

    for testing i implemented it with play at position, which is somewhat ok, as long as the player does not turn so fast... I dont like the idea to create so many objects... Anyways fantastic work and thanks for all the math! :D

  • Luckily the solution comes with R318 and the possibility to set the listener angle and play sounds at XYZ.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)