Gun laser goes through objects

Okay so I’ve been working on my own gun system. My plan was to add an aim laser.
What i mean with that is that a red line is coming out of the gun showing the path that your bullet will go. But when the red line comes across a object it wont scale down it will just go straight through the object.

Does someone know how i can make it so the red line stops at the object and doesn’t go through it. I’ve tried using ray casting, magnitude etc. but it doesn’t work

Example:

But i want this:

1 Like