Compare to cosine of angle, not angle.

This commit is contained in:
Daniel Buckmaster 2014-12-11 12:30:48 +11:00
parent 27252b0864
commit 93fdcdecbe

View file

@ -182,9 +182,9 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
cam.getColumn(3, &camPos);
cam.getColumn(1, &camDir);
F32 camFov;
conn->getControlCameraFov(&camFov);
camFov = mDegToRad(camFov) / 2;
F32 camFovCos;
conn->getControlCameraFov(&camFovCos);
camFovCos = mCos(mDegToRad(camFovCos) / 2);
// Visible distance info & name fading
F32 visDistance = gClientSceneGraph->getVisibleDistance();
@ -236,7 +236,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
// projection and box test.
shapeDir.normalize();
F32 dot = mDot(shapeDir, camDir);
if (dot < camFov)
if (dot < camFovCos)
continue;
// Test to see if it's behind something, and we want to