r/godot•
Jan_ikama

Shotgun pellets with raycast

help me

Hi, I'm trying to implement a shotgun who will shot multiple pellets using raycast3D, but I'm kinda stuck to make it work. I made this code using tutorials but only the spreading work.

I also thinking of using multiples raycasts in a circular arc pattern for each pellets, but having just one raycast seem the simplest solution

func shoot()
  for i in range(number of pellets):
    raycast.rotation_degrees # for random spread
    raycast.get_collision_point() #save the impact collision
    raycast.force_raycast_update() #update raycast immediatly for firing multiple raycast at once

Posted Oct 1, 2025, 9:04 PM UTC

11
Loading comments…