i want to instantiate a particle system at the position of the placed node
the node gets positioned by a raycast and gets the correct position
the instantiated particles spawn at the hit colliders' pivot point, wich is not what i want.
if i enable the local coordinates (in drawing) the particle system works correct, however i want the particles not to be attached to the hit object but play in world coordinates
extends Node
@export var impactSound : AudioStreamSample
@export var myAudioStream_path: NodePath
@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()
self.add_child(impactparticles)
impactparticles.transform.origin = self.transform.origin
impactparticles.emitting = true
playImpactSound()
func playImpactSound():
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()