How do I get this line trace to work

The glm::intersect functions do not say how to use them in their documentation and even when i have this I don’t know how to get the point of intersection.

I am only doing walls right now because they are easy to understand;

About the code that I am using:
direction = 0 forward is +Z
direction = 1 forward is +X
direction = 2 forward is -Z
direction = 3 forward is -X

the groups of 6 vertices are the vertices that make up my walls;

RenderInfo.loc has the physical location of the wall. camx and camz are the camera location.

struct NormalVertex {
	glm::vec3 position;
	glm::vec3 normal;
	glm::vec2 texCoord;
	float wallType;
	glm::vec3 tangent;
	glm::vec3 bitangent;
};

struct RenderInfo {
	glm::vec3 loc;
	NormalVertex verts[6];
};

void RayTrace::trace()
{
	
	depth = 2;
	bool renok = false;
	for (int i = 0; i < relinfo.size(); i++) {
		switch (direction) {
		case 0:
			if (relinfo.at(i).loc.z - camz >= 0) renok = true;
			break;
		case 1:
			if (relinfo.at(i).loc.x - camx >= 0) renok = true;
			break;
		case 2:
			if (relinfo.at(i).loc.z - camz <= 0) renok = true;
			break;
		case 3:
			if (relinfo.at(i).loc.x - camx <= 0) renok = true;
			break;
		}
		if (renok) {
			float lowx = 20000;
			float lowy = 20000;
			float lowz = 20000;
			float higx = -20000;
			float higy = -20000;
			float higz = -20000;
			glm::vec4 location;
			for (int j = 0; j < 6; j++) {
				location = projection * view * glm::vec4(relinfo.at(i).verts[j].position, 1.0f);
				if (location.x < lowx) lowx = location.x;
				if (location.y < lowy) lowy = location.y;
				if (location.x > higx) higx = location.x;
				if (location.y > higy) higy = location.y;
				if (location.z / location.w < lowz) lowz = location.z / location.w;
				if (location.z / location.w > higz) higz = location.z / location.w;
			}
			float ztr;
			if (cursx > lowx && cursx < higx && cursy > lowy && cursy < higy) {
				glm::vec3 anormal = relinfo.at(i).verts[0].normal;
				if (abs(anormal.x) > .5) {
					float wid = higx - lowx;
					ztr = (cursx - lowx) / wid;
					normType = 1;
				}
				else if (abs(anormal.y) > .5) {
					float wid = higy - lowy;
					ztr = (cursy - lowy) / wid;
					normType = 2;
				}
				else {
					ztr = 0;
				}
				float wid = higz - lowz;
				float idep = lowz + wid * ztr;
				if (idep < depth) {
					selNum = i;
					zam = ztr;
					wid = higx - lowx;
					xam = (cursx - lowx) / wid;
					wid = higy - lowy;
					yam = (cursy - lowy) / wid;

				}
			}
		}
	}
	//int dirx[] = {0, 1, 0, -1};
	//int dirz[] = { 1, 0, -1, 0 };
	if (selNum > -1) {
		error = false;
		glm::vec3 campos = glm::vec3(camx, 0, camz);
		float lowx = 20000;
		float lowy = 20000;
		float lowz = 20000;
		float higx = -20000;
		float higy = -20000;
		float higz = -20000;
		glm::vec3 location;
		for (int j = 0; j < 6; j++) {
			location = relinfo.at(selNum).verts[j].position - campos;
			if (location.x < lowx) lowx = location.x;
			if (location.y < lowy) lowy = location.y;
			if (location.x > higx) higx = location.x;
			if (location.y > higy) higy = location.y;
			if (location.z < lowz) lowz = location.z;
			if (location.z > higz) higz = location.z;
		}
		float xloc;
		float yloc = lowy + (higy - lowy) * yam;
		float zloc;
		switch (direction) {
		case 0:
			xloc = lowx + (higx - lowx) * -xam;
			zloc = lowz + (higz - lowz) * zam;
			break;
		case 1:
			xloc = lowx + (higx - lowx) * zam;
			zloc = lowz + (higz - lowz) * xam;
			break;
		case 2:
			xloc = lowx + (higx - lowx) * -xam;
			zloc = lowz + (higz - lowz) * -zam;
			break;
		case 3:
			xloc = lowx + (higx - lowx) * -zam;
			zloc = lowz + (higz - lowz) * -xam;
			break;
		}
		movement = glm::normalize(glm::vec3(xloc, yloc, zloc) - campos);
	}
	else {
		error = true;
	}
}


Here is some code that I found that gets me a movement vector

glm::vec3 camera_position(0.0f, 0.0f, 5.0f); // -Z is into the screen
glm::vec3 camera_target(0.0001f, 0.0f, -1.0f);
glm::vec3 camera_up(0.0f, 1.0f, 0.0f);

glm::mat4 view = glm::lookAt(camera_position, camera_target, camera_up);

float NDC_X = ((int)mousePosX * (2.0f / WindowWidth)) - 1;
float NDC_Y = -((int)mousePosY * (2.0f / WindowHeight)) + 1;

float near_plane_height = glm::tan(FOV / 2.0f) * near_plane;
float aspect_ratio = (float)WindowWidth / (float)WindowHeight;

float X_3D = NDC_X * near_plane_height * aspect_ratio;
float Y_3D = NDC_Y * near_plane_height;

glm::vec3 near_plane_point(X_3D, Y_3D, -near_plane); // Point is now in accordance with the camera in 3D space on the near plane
near_plane_point = glm::inverse(view) * glm::vec4(near_plane_point, 1.0f); // Point true position in 3D space
glm::vec3 cam_dir_vec = near_plane_point - camera_position;

glm::vec3 unProject = glm::unProject(glm::vec3(mousePosX, WindowHeight - mousePosY, 0.0f), view, projection, glm::vec4(0, 0, WindowWidth, WindowHeight));
glm::vec3 unProj_dir_vec = unProject - camera_position;

glm::vec3 ray_direction = glm::normalize(unProj_dir_vec);
ray_direction = glm::vec3(-ray_direction.x, ray_direction.y, -ray_direction.z);

movement = glm::vec3(glm::rotate(glm::mat4(1), camrot, glm::vec3(0, 1, 0)) * glm::vec4(ray_direction, 1));