# Detect object collision

**URL:** <https://discourse.threejs.org/t/detect-object-collision/29796>\
**Category:** Questions\
**Tags:** collision-detection, raycaster\
**Created:** [September 10, 2021, 10:58am UTC](https://discourse.threejs.org/t/detect-object-collision/29796 "2021-09-10T10:58:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikhil\_Shaji](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nikhil_shaji/32/20265_2.png) [@Nikhil\_Shaji](https://discourse.threejs.org/u/Nikhil_Shaji)\
**Post date:** [September 10, 2021, 10:58am UTC](https://discourse.threejs.org/t/detect-object-collision/29796/1 "2021-09-10T10:58:41Z")

</div>

Good day everyone.

I have a scene of a lot of meshes (not bufferGeometry). I want to create a hovering effect on the background individual meshes when I pick a mesh on mouse click-drag over em.  
I don’t have in-depth knowledge of raycasting.

Help me 🙂

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [September 10, 2021, 12:28pm UTC](https://discourse.threejs.org/t/detect-object-collision/29796/2 "2021-09-10T12:28:02Z")

</div>

Hi!  
Could you provide a simplified livecode working example, that contains the setup you have?  
And put more description (with explanatory pictures, if possible), of what you want to achieve.

---

<div class="post-metadata">

**Author:** ![Nikhil\_Shaji](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nikhil_shaji/32/20265_2.png) [@Nikhil\_Shaji](https://discourse.threejs.org/u/Nikhil_Shaji)\
**Post date:** [September 10, 2021, 1:21pm UTC](https://discourse.threejs.org/t/detect-object-collision/29796/3 "2021-09-10T13:21:37Z")

</div>

sorry, i cannot share the code here. And I don’t have a simplifies LiveCode as well.

Can you just imagine a scene:  
1: 10 square plane mesh put randomly on the ground  
2: we look from the top.  
3. I have implemented the code to pick the object and put it anywhere on the ground.

the problem or what I need is:  
when I pick one square and drag it to another place, if its hover over any other background square, those square should highlight

---

<div class="post-metadata">

**Author:** ![GlifTek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/gliftek/32/13131_2.png) [@GlifTek](https://discourse.threejs.org/u/GlifTek)\
**Post date:** [September 11, 2021, 12:34am UTC](https://discourse.threejs.org/t/detect-object-collision/29796/4 "2021-09-11T00:34:28Z")

</div>

You could use box3 to give the planes a bounding box (give them a small depth first) then update their bounding boxes each frame to their objects.

Then find if the dragged object is intersecting with any…then do a snap or whatever to the coordinates.

---

<div class="post-metadata">

**Author:** ![Nikhil\_Shaji](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nikhil_shaji/32/20265_2.png) [@Nikhil\_Shaji](https://discourse.threejs.org/u/Nikhil_Shaji)\
**Post date:** [September 11, 2021, 12:43pm UTC](https://discourse.threejs.org/t/detect-object-collision/29796/5 "2021-09-11T12:43:57Z")

</div>

sorry, I didn’t get you. Can you elaborate?
