Work out if something on screen

Hi,

For performance reasons I want to detect if an object is on screen or not so that I can disable things like raycasts if it’s not. I have no idea how to go about doing this, can anyone give me some pointers?

Thanks!

To solve this you need to know the view and projection matrices of the render script. I’m solving this in my Orthographic Camera API in the camera.world_to_screen() and camera.project() functions.

Great, looks like there are a couple of other handy function in there. Thanks.

If you’re not zooming your camera in and out or something like that, and your objects have collision objects on them, another easy way is to add trigger areas (collision objects) all around the camera view area and use the “trigger_response” message to enable and disable the objects.

2 Likes