🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

How to detect if a Sprite is visible by the camera?

A topic by natchooo created Jun 09, 2016 Views: 302 Replies: 3
Viewing posts 1 to 4
(Edited 1 time)


I am currently using an orthographic cam in a shmup kind of game, and trying to detect when bullets get out of the screen.

Does anyone know how i can do that please?

Thanks a lot.


Well, somehow i found a way using trigonometry rules:

if bullet.position.x > Math.tan(camfov) * campos.z

then the bullet is out of the screen.

Well i need to refine that so that it works in various cam positions and that it takes into account the bullet's size and that should do the job.

(Edited 1 time)

I would use invisible objects on the sides of the screen and use them to see if the object is within those bounds. (Put them around the screen)

That is one tricky way!