Skip to content

Commit

Permalink
Hide tempmodel when it is outside of the min/max distance range
Browse files Browse the repository at this point in the history
  • Loading branch information
smallmodel committed Oct 3, 2023
1 parent 58e3056 commit 9f42da4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/cgame/cg_tempmodels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,14 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
Vector delta;
Vector start;
Vector vForward, vLeft, vUp;
float fDist;

delta = m_spawnthing->cgd.origin - cg.refdef.vieworg;
fDist = delta * delta * (cg.refdef.fov_x * cg.refdef.fov_x / 6400.0);
if (fDist >= m_spawnthing->fMaxRangeSquared || fDist < m_spawnthing->fMinRangeSquared) {
// don't draw above the distance
return;
}

if (current_entity) {
current_entity_scale = current_entity->scale;
Expand Down

0 comments on commit 9f42da4

Please sign in to comment.