- Fix wrong math for model/light distance check

This commit is contained in:
Magnus Norddahl 2017-11-05 13:28:56 +01:00
parent ba298ccd6e
commit bd08568b90

View file

@ -209,12 +209,12 @@ void gl_SetDynModelLight(AActor *self, bool hudmodel)
{
int group = subsector->sector->PortalGroup;
DVector3 pos = light->PosRelative(group);
float radius = light->GetRadius();
float radius = light->GetRadius() + self->renderradius;
double dx = pos.X - x;
double dy = pos.Y - y;
double dz = pos.Z - z;
double distSquared = dx * dx + dy * dy + dz * dz;
if (distSquared < radiusSquared + radius * radius) // Light and actor touches
if (distSquared < radius * radius) // Light and actor touches
{
if (std::find(addedLights.begin(), addedLights.end(), light) == addedLights.end()) // Check if we already added this light from a different subsector
{