I've built a third person camera in C++ using DirectX that attaches itself to game objects such as the player. My walls are planes and I am utilizing line segment to plane intersection to know which walls I should alpha. The line segment is between my camera and the object I am attached to.
Here's the problem:
I can angle my camera to have a wall block half my view before rotating it enough for the line segment to plane intersection collision to detect that I am should alpha a certain wall.
Here's what I tried:
I get the magnitude of the point on the plane and the closest point on the line to the plane, subtract the two, and compare it to a distance to check wall alpha-ing.
The code doesn't seem to work so I'm looking for alternative solutions.Code:vector3 vPtOnPlane = fPlaneOffset * vPlaneNormal; vector3 a= vector3(vCameraPosition); vector3 b= vector3(vTargetPosition); vector3 line = b - a; vector3 linePt = ClosestPtToPlane(vector3 start, vector3 end, vector3 ptOnePlane); if( fabs(DotProduct(linePt, linePt) - DotProduct(vPtOnPlane, vPtOnPlane) < 50) AlphaOutWall();