Hello all, I have a working raycast3D that tells me when it collides with certain things and tells me what it collides with, but I'm struggling to have it emit particles at the location of where it collides. Right now I have the particle I want to emit as a child of the raycast, and when it collides with a wall it emits, but it emits at the raycast start location, not at where its actually colliding. Ideally I want the particles to emit back towards the direction where the raycast came from too.

extends RayCast3D

# The particle effect for brick wall
@onready var brickParticles = get_node("BrickWallParticles")

func fireShot(delta):
	if is_colliding():
		print("Colliding")
		if get_collider().is_in_group("Enemy"):
			print("Enemy hit")
			get_collider().hit()
		elif get_collider().is_in_group("Wall"):
			print("Hit wall")
			brickParticles.emitting = true
			brickParticles.restart()
	else:
		print("Not colliding with anything")

Thank you for any assistance.

  • xyz replied to this.
  • ChiefSquidlam Set particle's global position to raycast's collision point

    brickParticles.global_position = get_collision_point()

    ChiefSquidlam Set particle's global position to raycast's collision point

    brickParticles.global_position = get_collision_point()

      xyz This works perfectly, thank you so much. Now im starting to understand the logic behind modifying properties of nodes too, I think im overcomplicating it in my head