# \#raycast

**URL:** https://discourse.threejs.org/tag/raycast/880.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Why raycaster is not finding the buttons in my scene](https://discourse.threejs.org/t/why-raycaster-is-not-finding-the-buttons-in-my-scene/82763)

<div class="topic-metadata">

**Author:** [@FabianDim](https://discourse.threejs.org/u/FabianDim)\
**Replies:** 1\
**Last updated:** [May 26, 2025, 2:10am UTC](https://discourse.threejs.org/t/why-raycaster-is-not-finding-the-buttons-in-my-scene/82763 "2025-05-26T02:10:54Z")

</div>

I am trying to create some buttons that can be clicked to perform a function. However, it registers the clicks but does not find an element in the scene with the button’s name. Please see the code and an image of the sce…

---

## [Raycast for meshes and SDFs](https://discourse.threejs.org/t/raycast-for-meshes-and-sdfs/79724)

<div class="topic-metadata">

**Author:** [@hofk](https://discourse.threejs.org/u/hofk)\
**Replies:** 18\
**Last updated:** [March 19, 2025, 7:30pm UTC](https://discourse.threejs.org/t/raycast-for-meshes-and-sdfs/79724 "2025-03-19T19:30:18Z")

</div>

There SDFs in the scene - raymarching - #30 by hofk I have a basic variant for moving an SDF via raycast. Now I have combined raycasting for meshes and SDFs by creating two raycasters. I can move the meshes by clickin…

---

## [What is the best way to \`pick\` in WebGPU?](https://discourse.threejs.org/t/what-is-the-best-way-to-pick-in-webgpu/69973)

<div class="topic-metadata">

**Author:** [@Bob\_Lil](https://discourse.threejs.org/u/Bob_Lil)\
**Replies:** 2\
**Last updated:** [August 28, 2024, 6:33am UTC](https://discourse.threejs.org/t/what-is-the-best-way-to-pick-in-webgpu/69973 "2024-08-28T06:33:54Z")

</div>

I’ve been exploring WebGPURenderer and I’m currently working on object picking within the scene. In previous WebGLRenderer, due to readPixel is sync, which may cause IO block type performance issue, choosing raycasting …

---

## [Raycasting and rotation matrices](https://discourse.threejs.org/t/raycasting-and-rotation-matrices/61764)

<div class="topic-metadata">

**Author:** [@raaaahman](https://discourse.threejs.org/u/raaaahman)\
**Replies:** 8\
**Last updated:** [February 26, 2024, 11:07am UTC](https://discourse.threejs.org/t/raycasting-and-rotation-matrices/61764 "2024-02-26T11:07:25Z")

</div>

Hello everyone, I’ve been following (at a veeery slow pace) Freya Holmer’s awesome Math for Game Devs course, and I’m at the chapter about 4x4 matrices and cross products. Trying to replicate heur demonstration into Th…

---

## [Could someone help me with this Im just new to learning threejs](https://discourse.threejs.org/t/could-someone-help-me-with-this-im-just-new-to-learning-threejs/59444)

<div class="topic-metadata">

**Author:** [@Benjamin\_MANGONDAYA](https://discourse.threejs.org/u/Benjamin_MANGONDAYA)\
**Replies:** 4\
**Last updated:** [December 20, 2023, 4:21am UTC](https://discourse.threejs.org/t/could-someone-help-me-with-this-im-just-new-to-learning-threejs/59444 "2023-12-20T04:21:02Z")

</div>

Hello everyone! Im having problem with raycasting to an gltf scene’s child. My goal is to higlight a child object of my gltf file when hovered and can be clicked to have a pop up message. I already found out the pop ups …

---

## [Raycaster triggers all tiles without mouse moving](https://discourse.threejs.org/t/raycaster-triggers-all-tiles-without-mouse-moving/55343)

<div class="topic-metadata">

**Author:** [@Cube\_3js](https://discourse.threejs.org/u/Cube_3js)\
**Replies:** 2\
**Last updated:** [August 28, 2023, 12:45am UTC](https://discourse.threejs.org/t/raycaster-triggers-all-tiles-without-mouse-moving/55343 "2023-08-28T00:45:46Z")

</div>

Hello! I am stuck on this problem where I would like to have an individual tile turn pink if I hover over it. However, all of the tiles turn pink, immediately upon refreshing the page. I am not sure what I might be doin…

---

## [Raycasting visible objects under few layers in glb model using orthographic projection](https://discourse.threejs.org/t/raycasting-visible-objects-under-few-layers-in-glb-model-using-orthographic-projection/53154)

<div class="topic-metadata">

**Author:** [@Razni\_Hashim](https://discourse.threejs.org/u/Razni_Hashim)\
**Replies:** 4\
**Last updated:** [June 24, 2023, 8:39am UTC](https://discourse.threejs.org/t/raycasting-visible-objects-under-few-layers-in-glb-model-using-orthographic-projection/53154 "2023-06-24T08:39:43Z")

</div>

I’m new to ThreeJS and I would like to know whether it raycasting is possible for visible objects that are under few layers in a glb model? I have several layers of objects and when orthographically projected they give a…

---

## [How to move an object toward another object until collision?](https://discourse.threejs.org/t/how-to-move-an-object-toward-another-object-until-collision/47739)

<div class="topic-metadata">

**Author:** [@winnip\_fr](https://discourse.threejs.org/u/winnip_fr)\
**Replies:** 2\
**Last updated:** [February 8, 2023, 9:00am UTC](https://discourse.threejs.org/t/how-to-move-an-object-toward-another-object-until-collision/47739 "2023-02-08T09:00:50Z")

</div>

Hi, I’ve loaded two objects in my scene. A matrix have been apply to one objet. I want to move the second objet along a particular axis toward the second object until they intersect. My goal is to display the distance…

---

## [Adding a 2d mesh as a button using raycasting to download a document in threejs scene](https://discourse.threejs.org/t/adding-a-2d-mesh-as-a-button-using-raycasting-to-download-a-document-in-threejs-scene/45949)

<div class="topic-metadata">

**Author:** [@Harsh\_Rathore](https://discourse.threejs.org/u/Harsh_Rathore)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 1:24pm UTC](https://discourse.threejs.org/t/adding-a-2d-mesh-as-a-button-using-raycasting-to-download-a-document-in-threejs-scene/45949 "2022-12-19T13:24:24Z")

</div>

Hi! I’m creating a scene wherein I need to download a document file when a 2d mesh is clicked using raycasting. I have created 2 meshes that play and pause a video using raycasting but I’m unsure about the downlaod part…

---

## [Help find a solution](https://discourse.threejs.org/t/help-find-a-solution/44080)

<div class="topic-metadata">

**Author:** [@Gta\_Sektor](https://discourse.threejs.org/u/Gta_Sektor)\
**Replies:** 2\
**Last updated:** [October 28, 2022, 7:24am UTC](https://discourse.threejs.org/t/help-find-a-solution/44080 "2022-10-28T07:24:16Z")

</div>

The object changes position along two axes (x,z) and follows the mouse pointer GridHelper - enabled Please tell me how to make the object following the mouse pointer, figuratively speaking, attach to the intersections …

---

## [Raycasting intersects objects which are present on front and back view](https://discourse.threejs.org/t/raycasting-intersects-objects-which-are-present-on-front-and-back-view/43023)

<div class="topic-metadata">

**Author:** [@rashmijl](https://discourse.threejs.org/u/rashmijl)\
**Replies:** 3\
**Last updated:** [October 4, 2022, 11:55am UTC](https://discourse.threejs.org/t/raycasting-intersects-objects-which-are-present-on-front-and-back-view/43023 "2022-10-04T11:55:36Z")

</div>

We are using raycasting to identify which mesh is interacted on click of 3d model. But this returns objects which present both front and back view. Is there any way we can get only front view objects when model shows fr…

---

## [Change color of instance mesh index on raycast](https://discourse.threejs.org/t/change-color-of-instance-mesh-index-on-raycast/38136)

<div class="topic-metadata">

**Author:** [@Michael\_Nicol](https://discourse.threejs.org/u/Michael_Nicol)\
**Replies:** 3\
**Last updated:** [May 14, 2022, 8:07pm UTC](https://discourse.threejs.org/t/change-color-of-instance-mesh-index-on-raycast/38136 "2022-05-14T20:07:17Z")

</div>

I am working on a project and need to be able to click on a instance mesh and highlight clicked cubes that make up that mesh. Here is the project: Test - CodeSandbox I created a this.\_createRayCaster method that create…

---

## [How to prevent raycast from firing when I touch an html element?](https://discourse.threejs.org/t/how-to-prevent-raycast-from-firing-when-i-touch-an-html-element/30262)

<div class="topic-metadata">

**Author:** [@MixTeR](https://discourse.threejs.org/u/MixTeR)\
**Replies:** 7\
**Last updated:** [October 12, 2021, 7:34am UTC](https://discourse.threejs.org/t/how-to-prevent-raycast-from-firing-when-i-touch-an-html-element/30262 "2021-10-12T07:34:00Z")

</div>

Hello. The problem is I have some overlapping htmls elements and behind is the scene with some “touchable” elements and when I touch for example a html button and behind is a “touchable” element the raycast is activated.…

---

## [Sand Nefertiti (three-mesh-bvh)](https://discourse.threejs.org/t/sand-nefertiti-three-mesh-bvh/29098)

<div class="topic-metadata">

**Author:** [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Replies:** 6\
**Last updated:** [August 20, 2021, 10:34pm UTC](https://discourse.threejs.org/t/sand-nefertiti-three-mesh-bvh/29098 "2021-08-20T22:34:30Z")

</div>

Hi community! For years I’ve been dreaming about an instrument, that would allow me to fill a mesh with points, so I could create cool things. My own attempt, based on default raycasting with counting of intersections,…

---

## [Optimized way to detect 2 detailed models collision](https://discourse.threejs.org/t/optimized-way-to-detect-2-detailed-models-collision/26568)

<div class="topic-metadata">

**Author:** [@Domantas\_Krasuckis](https://discourse.threejs.org/u/Domantas_Krasuckis)\
**Replies:** 10\
**Last updated:** [June 3, 2021, 4:40pm UTC](https://discourse.threejs.org/t/optimized-way-to-detect-2-detailed-models-collision/26568 "2021-06-03T16:40:38Z")

</div>

Hello, I am trying to do optimized code for 2 detailed models collision detection. 1 model has a lot of vertexes, so with raycast I can’t do it normally. I need solution which moves object +1 to z-coord until it collide…

---

## [Drag objects along circular path (Raycaster)](https://discourse.threejs.org/t/drag-objects-along-circular-path-raycaster/26121)

<div class="topic-metadata">

**Author:** [@ausra](https://discourse.threejs.org/u/ausra)\
**Replies:** 5\
**Last updated:** [May 12, 2021, 9:32am UTC](https://discourse.threejs.org/t/drag-objects-along-circular-path-raycaster/26121 "2021-05-12T09:32:46Z")

</div>

Hi, How could I drag an object along a circular path using raycaster?

---

## [Raycast mouse X and Y co-ordinates problem in mobile landscape mode](https://discourse.threejs.org/t/raycast-mouse-x-and-y-co-ordinates-problem-in-mobile-landscape-mode/25577)

<div class="topic-metadata">

**Author:** [@J\_V](https://discourse.threejs.org/u/J_V)\
**Replies:** 2\
**Last updated:** [April 22, 2021, 9:39am UTC](https://discourse.threejs.org/t/raycast-mouse-x-and-y-co-ordinates-problem-in-mobile-landscape-mode/25577 "2021-04-22T09:39:46Z")

</div>

Hi, I am facing raycast issue when the web application runs on landscape mode. Ray direction is incorrect. mouse.x = ( e.touches\[0\].pageX / window.innerWidth ) \* 2 - 1; mouse.y = - ( e.touches\[0\].pageY / window.innerH…

---

## [Raycast intersecting with hidden object](https://discourse.threejs.org/t/raycast-intersecting-with-hidden-object/18797)

<div class="topic-metadata">

**Author:** [@RAUMIK\_RANA](https://discourse.threejs.org/u/RAUMIK_RANA)\
**Replies:** 4\
**Last updated:** [September 17, 2020, 12:40pm UTC](https://discourse.threejs.org/t/raycast-intersecting-with-hidden-object/18797 "2020-09-17T12:40:58Z")

</div>

is there any way, raycast only works for visible objects in scene.
