How do I position audio relative to players rotation?

0 favourites
  • 8 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Hi

    In the Scirra supplied example (https://dropfile.to/oqHZSOB)

    The positioned audioworks only relative to the screen.

    Is there a way to make it work relative to the players rotation?

    Sort of first person shooter-like audio?

  • What about a simple trick of setting audio volume based on player angle. That would be just a couple of lines of events like:

    CONDITION #1: Dead / Boom / Whatever

    CONDITION #2: SYSTEM is between values: angle(player.x,player.y,whatever.x,whatever.y) from BLA angle to BLA angle.

    ACTION: Play audio at normal volume

    otherwise play at half or 1/3rd volume

  • I tried it here:

    https://dropfile.to/tgRAxdU

    But it doesn't seem to work at all..

  • Maybe I just don't quite understand the angle(x1, y1, x2, y2) function?

    What should the values be between as an example?

    • and a third of the volume - is that like -3 db?
  • Here you go, I came up with a much simpler solution for you:

    audio relative to players rotation by COSMOS for engberg.capx

    https://dropfile.to/NCUNcxY

  • Hi - thank you for the effort!

    What I'm trying to achieve is when the player-sprites right ear is towards the explosion, then it should only be heard in my right ear..

    Imagine closing your eyes, you should be able to find the explosion with only the audio..

    That doesn't happen in your example - and in the scirra supplyed example - it only works relative to my position in front of the screen - not relative to the player-sprite..

  • Hi,

    Well I answered, I think correctly, this forum thread which was about "relative to players rotation".

    You are now speaking about stereo audio, i.e. different sound per left and right speaker/headphone. You can still use my system / suggestion by having then 2 of those "visible triangles" but to the right and left of the player, so triggering is no problem, but I have not learned or seen anything about a stereo audio in C2, so maybe it does not exist or maybe a more experienced person can answer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I apologise if the title was misleading..

    I might be able to use your example, but then split the sound source in right and left channel..

    But then it is crucial, that they start at the same time..

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