i fixed the scaling of the decal by setting the 'extends' in the decals' script
now i need to figure out random rotation on Yaxis
extends Decal
@export var impactSound : AudioStreamSample
@export var myAudioStream_path: NodePath
@export var maxExtends = 0.1
@export var minExtends = 0.02
@export var particles : PackedScene
@onready var random = RandomNumberGenerator.new()
@onready var myAudio = get_node(myAudioStream_path)
func _ready():
random.randomize()
add_to_group("ignore")
var impactparticles = particles.instantiate()
get_tree().get_root().add_child(impactparticles)
impactparticles.global_transform.origin = self.global_transform.origin
impactparticles.emitting = true
playImpactSound()
var size = random.randf_range(minExtends,maxExtends)
self.extents = Vector3(size,size,size)
func playImpactSound():
if not is_instance_valid(myAudio):
return
myAudio.stream = impactSound
myAudio.pitch_scale = random.randf_range(0.8, 1.2)
if myAudio.playing == false:
myAudio.play()
else:
myAudio.queue_free()
func _on_visible_on_screen_notifier_3d_screen_exited():
self.queue_free()
im also wondering why my particles spawn at the same position
even if i enable/disable local coordinates of the drawing of the particle mesh they always spawn at world root axis
edit'
particles spawn at hit objects' pivot point not at instantiated decal position