Use of raycaster

I use raycaster for first person collision detection. When the controller looks up or down, it will pass through the object

contralspoint.rar (3.0 KB)

There’s no question though :’)

There can be quite a few reasons why the viewer is passing through objects - using a raycaster is one thing, but how do you handle the collisions themselves (ie. what happens in the code, when you hit a wall) ?

I found that when my viewer detects an object, my ray will vibrate. When the ray rotates to a certain angle, the viewer will pass through the object, that is, the ray cannot detect the object

The above compressed package is my code, can you help me to see the cause of this situation?

This is my ray