# How to detect intersections of two faces of two bufferGeometryBox?

**URL:** <https://discourse.threejs.org/t/how-to-detect-intersections-of-two-faces-of-two-buffergeometrybox/7761>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [May 27, 2019, 12:11pm UTC](https://discourse.threejs.org/t/how-to-detect-intersections-of-two-faces-of-two-buffergeometrybox/7761 "2019-05-27T12:11:31Z")\
**Posts on this page:** 1\
**Showing post:** 13

<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:** [May 29, 2019, 7:17am UTC](https://discourse.threejs.org/t/how-to-detect-intersections-of-two-faces-of-two-buffergeometrybox/7761/13 "2019-05-29T07:17:36Z")

</div>

> [@Arkadiy\_Vinkovskiy](#):
>
> `tri.getMidpoint(ori);`

I used it for simplicity and to show the conception, but it’s not the ultimate solution. If you’ve read [How to find wall thickness of 3d models (STL) files?](https://discourse.threejs.org/t/how-to-find-wall-thickness-of-3d-models-stl-files/5719) carefully, then at the end of it you could find the link to the [SO answer](https://stackoverflow.com/a/55159041/4045502) with the solution of how to get a random point on a face (triangle).

You say, that you just copied a piece of code. But it’s irrelevant. It’s just a concept of how to get origin and direction for a raycaster. And in your case, you have to convert them from local coordinates to world coordinates. After that you have to find intersection with the cube that is opposite to the current one and use that concept with flags for sides. Thus, each cube you add to the scene already has to have `.userData.sides` property.

Please, read about [.intersectObjects](https://threejs.org/docs/#api/en/core/Raycaster.intersectObjects) method of raycaster.

---

_[View the full topic](https://discourse.threejs.org/t/how-to-detect-intersections-of-two-faces-of-two-buffergeometrybox/7761)._
