Weapon HitScan in 3D

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

I asked This Question earlier but it seems that no one has seen it, so i am asking again the same question
I started using godot a couple weeks ago,
I have a problem so i folllowed the video here: https://www.youtube.com/watch?v=4jbfIN4t83k&t=0s ,when the raycast (the actual raycast)goes from the middle of the screen instead of going from the muzzle thats attatched to the gain,it’s working fine:

var raycast = $RayCast
if raycast.is_colliding:
   var collider = raycast.get_collider()
if collider:
   var target = collider
   print(target)

but when the raycast (world raycast) goes from muzzle(which is located in the middle of the gun) to the actual raycast collision point, it’s not working,all it detects is the room I am in(Room type is a CSCBox)**

if raycast.is_colliding():
	var bullet = get_world().direct_space_state
    var collision = bullet.intersect_ray(muzzle.transform.origin, raycast.get_collision_point())
if collision:
    var target = collision.collider
   print(target)

heres my character whole code: https://github.com/lowy98/3D/blob/master/Fps_Character
(I don’t think there is something wrong with the code tho) let me know if you know what the problem might be,
Thanks,

Note: the raycast is already enabled…