Correct local normal from raycasting

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MartinKingHUN

My function recieves 3 information from raycasting.
I would like to emit particles in the normal direction, and more importantly, in the refraction direction.
The problem is, that the emission direction changes when the object rotates, I guess because the direction is in world coordinates.

func shot(_position : Vector3, _impulse : Vector3, _normal : Vector3):
    apply_impulse(_position, _impulse)
    $Particles.translation = _position
    $Particles.rotation = _normal
    #$Particles.process_material.direction = _impulse - _normal * (_normal.dot(_impulse) * 2)
    $Particles.process_material.direction = _normal
    $Particles.restart()

Thanks in advance.