Added voice audio
This commit is contained in:
19
client/player/voice/VoiceComponent.gd
Normal file
19
client/player/voice/VoiceComponent.gd
Normal file
@ -0,0 +1,19 @@
|
||||
class_name VoiceComponent
|
||||
extends Node
|
||||
|
||||
@export var skeleton: Skeleton3D
|
||||
|
||||
var audio: AudioStreamPlayer3D
|
||||
|
||||
func _ready():
|
||||
audio = $Mouth
|
||||
|
||||
var attachment := BoneAttachment3D.new()
|
||||
attachment.bone_name = "Head"
|
||||
attachment.bone_idx = skeleton.find_bone("Head")
|
||||
audio.reparent(attachment)
|
||||
skeleton.add_child(attachment)
|
||||
|
||||
func play(stream: AudioStream):
|
||||
audio.stream = stream
|
||||
audio.play()
|
10
client/player/voice/VoiceComponent.tscn
Normal file
10
client/player/voice/VoiceComponent.tscn
Normal file
@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://csidusk3jpq0m"]
|
||||
|
||||
[ext_resource type="Script" path="res://player/voice/VoiceComponent.gd" id="1_8w0p0"]
|
||||
|
||||
[node name="Voice" type="Node"]
|
||||
script = ExtResource("1_8w0p0")
|
||||
|
||||
[node name="Mouth" type="AudioStreamPlayer3D" parent="."]
|
||||
max_distance = 30.0
|
||||
bus = &"Voices"
|
Reference in New Issue
Block a user