# Passing through object when clicking

**URL:** https://discourse.processing.org/t/passing-through-object-when-clicking/24338
**Category:** Libraries
**Created:** [October 4, 2020, 6:24pm UTC](https://discourse.processing.org/t/passing-through-object-when-clicking/24338 "2020-10-04T18:24:29Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [October 4, 2020, 7:19pm UTC](https://discourse.processing.org/t/passing-through-object-when-clicking/24338/2 "2020-10-04T19:19:28Z")

</div>

In my opinion see [screenX screenY equivalent in p5.js](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581/5)

so it’s another way of picking: each cube stores it’s 2D screen pos.

When the mouse is clicked, check mouseX,mouseY against the 2D screen pos using dist() command

---

_[View the full topic](https://discourse.processing.org/t/passing-through-object-when-clicking/24338)._
