Bug on casting Rays (Javascript)

I am casting rays through wall, every ray will contain informations about (objectHIT,pointIntersectionXY)

I was able to do some casting, but the collision is not always working as expected. I review the code many time but i still dont understand where could i go wrong.

First off all, the coordinates of my intersections along the others atributes are all organized and correct and stored in (listCollision) throught my other function that calculate the collisions.

*//listCollision[The ray that is casting][The Object that was hitted].OthersAtributes*
*//VisaoLimitada[Index of Ray].attributes*


limitDistance(listCollision,visaoLimitada) {   
            
            for (let i = 0; i < this.laser; i++) {
                var distanciaV = { 
                x1: visaoLimitada[i].x1, 
                y1: visaoLimitada[i].y1, 
                x2: visaoLimitada[i].x2, 
                y2: visaoLimitada[i].y2 };
                
                var originDistance = this.distanceC(distanciaV.x1,distanciaV.x2,distanciaV.y1,distanciaV.y2); //This function returns the distance of two given points
    
                for (let j = 0; j < listCollision[i].length; j++) {
                    var distanciaAtingida = { 
                    x1: distanciaV.x1, 
                    y1: distanciaV.y1, 
                    x2: listCollision[i][j].x, 
                    y2: listCollision[i][j].y };
                
                    var objectDistance = this.distanceC(distanciaAtingida.x1,distanciaAtingida.x2,distanciaAtingida.y1,distanciaAtingida.y2);
    
                    if(objectDistance<originDistance){
                    visaoLimitada[i] = distanciaAtingida;
                    originDistance = visaoLimitada[i]; //Para encontrar novo proximo objeto mais proximo
                    }

                }
            }
            return visaoLimitada;
        }
        
        calculateViewport(FOV){

            var intervaloX = (this.player[3].x - this.player[1].x)/this.laser;
            var intervaloY = (this.player[3].y - this.player[1].y)/(this.laser-1);
            
            //In the GAMELOOP, first call calculateViewport(), and set the casting rays to a straight line
            //After that is called calculateViewport(listCollisions), and the position of the final XY rays gonna be setup by the collisions
            if(FOV==null || this.isEmpty(FOV) == 1){

                for(let i=0;i<this.laser;i++){    

                this.visao[i].x1 = this.player[1].x+ 1*Math.cos(this.radians(this.aX)) + i * intervaloX;
                this.visao[i].y1 = this.player[1].y+ 1*Math.sin(this.radians(this.aX)) + i * intervaloY;
                this.visao[i].x2 = this.player[1].x+this.distanceView*Math.cos(this.radians(this.aX))+ i * intervaloX;
                this.visao[i].y2 = this.player[1].y+this.distanceView*Math.sin(this.radians(this.aX))+ i * intervaloY;
            }
            

        }
        else{

            this.visao = this.limitDistance(FOV,this.visao);

        }

        }