The faster the actor, the louder it get. Is it possible?

MarkOnTheIronMarkOnTheIron Member Posts: 1,447
edited November -1 in Working with GS (Mac)
I would like my actor to play a sound (and that's easy), and i would like this sound volume to be proportional to the actor velocity.

Is it possible?

Comments

  • BeyondtheTechBeyondtheTech Member Posts: 809
    I believe the sound effects' volume can only be set at the time of its instance of it being played. Music playback can be changed dynamically using the Volume attribute, so unless you want a looping sound played as music, that may be your only way.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    In the Play Sound behavior, you can adjust the volume between 0 and 1 using an expression and have that expression use the velocity of the actor as a variable.

    As BeyondtheTech said, you can adjust the music played via Play Music by adjusting the Volume attribute. That you can use a constrain attribute behavior using the actor's velocity as the variable. Again the volume can only have a value between and including 0 and 1.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Just resolved it!

    Here's what I did:

    - created attribute VolumeSpeed
    - on my moving actor I put behavior Constraint Attribute <VolumeSpeed> to <max(0, min(1, 1*abs( self.Motion.Linear Velocity.X /200)))>
    - on my moving actor I put a Play Sound behavior (not Play Music because it sounds better and works with other sounds) and on the volume I put <VolumeSpeed>

    And you know what? It worked!
Sign In or Register to comment.