Added voice audio

This commit is contained in:
2024-02-16 15:30:29 +01:00
parent 91f5167d6a
commit 89d730f0ae
13 changed files with 86 additions and 49 deletions

View 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()