Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
0
Members

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

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

Hi,

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.

(+1)

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.

(1 edit)

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!