Physhics.Raycast not working properely

Hello, I am making an FPS game and I’m using Raycasting as a way of hitting the enemy, but there’s an issue when I start the game it detects that I hit enemy only 3 or 4 times, when I shoot again and I am for the enemy it ignoring him and it detects i am hitting a wall or a ground. Does anyone know what might be the issue of causing this?

It is hard to say without seeing any of the code.

It may be that the raycast is not going in the direction it is intended to. Try using Debug.DrawRay with the same direction you are using for your raycast. That way you can see where the raycast is going.

@kylecat6330 I tried drawing the ray and it is going in the direction it is intended to. It looks like this and I also did enabled gizmos

193341-asdasdasdasdasd.png