# How to check if something is on screen

**URL:** <https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483>\
**Category:** Coding Questions\
**Created:** [August 25, 2022, 2:39am UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483 "2022-08-25T02:39:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![graph100](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/graph100/32/12557_2.png) [@graph100](https://discourse.processing.org/u/graph100)\
**Post date:** [August 25, 2022, 2:39am UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483/1 "2022-08-25T02:39:08Z")

</div>

Hi, I was wondering if there was a way to see if something is being displayed on the current canvas in WEBGL mode. I’m working on a game and i have a class of objects that i need to know if they are on screen (that includes being infront of the camera, being within the bounds of the viewport, and it must be at least partially unobstructed). I have multiple objects in the game world, each of which has a defined position and size (including the objects that need to be checked). I have a vague idea of how to make this happen, but I wanted some further guidance.

I would think that the best choice of action was to first project the position of the object to see if it would be on screen, then raycast to see if obstructed, and use the direction of the raycast to see if it is behind the camera or not.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [August 25, 2022, 8:34am UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483/2 "2022-08-25T08:34:53Z")

</div>

Hi  
Useful videos and some hints

https://www.youtube.com/embed/videoseries?list=PLsGCUnpinsDmghIwGww77MRn1vvKjPVqV&wmode=transparent&rel=0&autohide=1&showinfo=1&enablejsapi=1

 ![Screenshot_2022-08-25-11-38-35-850](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/9/a/9a35506c20417552df2f1977b834e859b4537cb2.jpeg)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [August 25, 2022, 11:17am UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483/3 "2022-08-25T11:17:44Z")

</div>

I think OP is talking about the virtual 3D camera we use in webgl and not about the webcam.

So the camera() command

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [August 25, 2022, 12:35pm UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483/4 "2022-08-25T12:35:01Z")

</div>

Yes you are true I didn’t notice

---

<div class="post-metadata">

**Author:** ![graph100](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/graph100/32/12557_2.png) [@graph100](https://discourse.processing.org/u/graph100)\
**Post date:** [August 25, 2022, 2:41pm UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483/5 "2022-08-25T14:41:37Z")

</div>

yeah im looking for how to with the webgl camera
