# I don't get the clicked object in raycast intersect list

**URL:** <https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869>\
**Category:** Questions\
**Tags:** click, raycaster, geometry\
**Created:** [July 8, 2021, 10:14am UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869 "2021-07-08T10:14:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lohithkumarr95](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@lohithkumarr95](https://discourse.threejs.org/u/lohithkumarr95)\
**Post date:** [July 8, 2021, 10:14am UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869/1 "2021-07-08T10:14:41Z")

</div>

Hello, i have a Room created with BoxGeometry and i have a. object inside the room.  
So i need to perform some actions only when user mouse clicks on that particular object.  
But right now whenever i make a click i always get BoxGeometry (i.e the room object). I dont know why the clicked object is not adding to the raycast intersect list.

Can someone please me with this. Thanks in advance

---

<div class="post-metadata">

**Author:** ![dllb](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dllb/32/19191_2.png) [@dllb](https://discourse.threejs.org/u/dllb)\
**Post date:** [July 8, 2021, 1:42pm UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869/2 "2021-07-08T13:42:32Z")

</div>

You haven’t provided enough details, as what kind of object is, and whether you pass the scene or the object to the raycaster. If the objects are models loaded and not created inside three.js, you could add the ones you want to be checked to an array and pass that array to the raycaster instead of the scene, which always works.

---

<div class="post-metadata">

**Author:** ![lohithkumarr95](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@lohithkumarr95](https://discourse.threejs.org/u/lohithkumarr95)\
**Post date:** [July 9, 2021, 10:26am UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869/3 "2021-07-09T10:26:23Z")

</div>

@dllb thanks for the reply. I am really sorry for the non detailed question. Actually i am very new to three js, what i was trying to explain is that i need to add hotspot kind of a thing inside the room and i need to trigger click event only when user click that hotspot.

below is what i am passing to the raycast.

```javascript
var intersects = raycaster.intersectObjects(scene.children);

```

Can u please help.

---

<div class="post-metadata">

**Author:** ![dllb](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dllb/32/19191_2.png) [@dllb](https://discourse.threejs.org/u/dllb)\
**Post date:** [July 9, 2021, 2:34pm UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869/4 "2021-07-09T14:34:26Z")

</div>

There is obviously some bug in your code, and I cannot guess that bug from one correct line of code.  
Since you’re new to three.js, the best tactic is to start with one of the three.js examples, recreate it locally to work as is, then gradually make modifications towards your needs, until you change it completely to do what you want.

You could try this example:  
[https://threejs.org/examples/webgl\_interactive\_cubes.html](https://threejs.org/examples/webgl_interactive_cubes.html)

Either change the two import lines (for your convenience) to:

```javascript
import * as THREE from 'https://cdn.skypack.dev/three@0.130.0/build/three.module.js'  

import Stats from 'https://cdn.skypack.dev/three@0.130.0/examples/jsm/libs/stats.module.js';

```

Or use node.js.

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [July 10, 2021, 8:55pm UTC](https://discourse.threejs.org/t/i-dont-get-the-clicked-object-in-raycast-intersect-list/27869/5 "2021-07-10T20:55:17Z")

</div>

Be sure to set second argument of `raycaster. intersectObjects` to `true` - otherwise only the top-most object is tested (see [docs](https://threejs.org/docs/?q=raycas#api/en/core/Raycaster.intersectObjects).)

Alternatively, you can also pass all objects inside the room manually - along with the room:

```javascript
const intersects = raycaster.intersectObjects([
  scene,
  ...scene.children
]);

```
