How to find an intersection length of a raycast?

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

So i’d like to know how long does my raycast intersect a body.
I’m trying to make a cs:go like bullet penetration system for my project.

enter image description here

My Current Code: (goes through all the objects on the way one by one)

func shoot(damage:int=30) -> void:
	clear_exceptions()
	
	while is_colliding():                #Loop till no colliders
		force_raycast_update()           #Update raycast with updated expections
		var collider = get_collider()    #Get current colliding body
		add_exception(collider)          #Add the hit collider to expections
		
		if collider.is_in_group("damagable"):
			collider.health -= damage    #If target can be damaged, damage it
		
		#############################
		#ADD DAMAGE PENETRATION HERE#
		#############################
		
		if damage <= 0:                   #If the ray doesn't have any damage anymore, break the loop
			break
		
	print(damage)
:bust_in_silhouette: Reply From: Johnny Johnny

hey,
did you find any solution to this?
thanks in advance