This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-09-19 22:31:55 +02:00
|
|
|
extends RigidDynamicBody3D
|
2021-09-08 22:00:32 +02:00
|
|
|
|
2021-09-12 04:28:38 +02:00
|
|
|
@onready var sound = $Sound
|
|
|
|
@onready var sound_player = sound.get_node("AudioStreamPlayer3D")
|
2021-09-08 22:00:32 +02:00
|
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
|
|
# var a = 2
|
|
|
|
# var b = "text"
|
|
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
#func _process(delta):
|
|
|
|
# pass
|
|
|
|
|
|
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
|
|
queue_free()
|
2021-09-12 04:28:38 +02:00
|
|
|
|
|
|
|
func _on_Casing_body_entered(body):
|
|
|
|
var vel = linear_velocity.length()
|
2021-09-12 04:46:48 +02:00
|
|
|
#print(linear_velocity.length())
|
2021-09-12 04:28:38 +02:00
|
|
|
|
2021-09-12 04:46:48 +02:00
|
|
|
if vel > 1:
|
2021-09-12 04:28:38 +02:00
|
|
|
sound_player.unit_db = -48 + min((pow(vel, 3)), 48)
|
2021-09-12 04:46:48 +02:00
|
|
|
sound.play()
|