Page 1 of 1

Determining whether an entity is currently in view

Posted: Mon Nov 25, 2024 10:10 am
by pindab0ter
Is there a way to determine whether an entity is currently being rendered to any player?

I would like to improve the performance of a mod by not processing entities that are not in any view.

The only way I can think of is to check every player, check whether they are in map view, if they are on the right surface, what their zoom level, resolution and display density scale are and then manually calculate whether a given entity should be able to be seen.

This sounds very CPU intensive to do every tick, and doesn't take into account a GUI camera for example.

Doe anyone know of a better way to do this?

Worst case, I'll just check whether any player is in camera view (not map view) on the surface the entity is on, without taking proximity into account.