0 votes

How would I play music that sounds like it originates from all sides of a shape, i.e. your distance from the edge of a CollisionShape2D controls the decibels of your AudioStreamPlayer.

# Here is some pseduo-code
func adjust_ambiance_sound():
    var direction_to_collision_shape_2d = player.get_global_position() + (player.get_global_position() - collision_shape_2d.get_global_position())
    var result = get_world_2d().direct_space_state.intersect_ray(player.get_global_position(), direction_to_collision_shape_2d)
    sound_player_2d.volume_db = result["position"].length() / SOUND_SCALAR
in Engine by (169 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.