Hover Over Objects in ThreeJS - Raycast

Опубликовано: 10 Июль 2026
на канале: Class Outside
1,834
42

A common way to see what your mouse is pointing at in 3D space is to use raycasting. With just a few steps, you can get a list of all objects your mouse is pointing towards, and even select just the first one if that is all that you need.

Tools:
Blender default download: https://www.blender.org/download/
Blender 3.4 download: https://download.blender.org/release/...
Visual Studio Code: https://code.visualstudio.com/download
-ThreeJS online editor: https://threejs.org/editor/

Project Code:
https://github.com/ClassOutside/Hover...

Other Tutorials:
Export Blender to ThreeJS:    • Import Blender Scene To Three JS - Using T...  
Bundle with Webpack:    • Serve Only The Files You Need With Webpack...  

Media:
"1930's Movie Camera" (https://skfb.ly/6SKrW) by Daz is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....
"Studio Setup" (https://skfb.ly/opCzL) by Render Blue is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....
"1800s Card Playing Tables" (https://skfb.ly/oxwID) by Mad_Lobster_Workshop is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....
"Seamless Crumpled Carpet PBR Texture" (https://skfb.ly/6VyuB) by d0ggo is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....
"Playing Cards" (https://skfb.ly/oDIqr) by DudleyLong is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....

If this was helpful, consider leaving a comment or supporting me on Ko-fi: https://ko-fi.com/classoutside

===== TIMESTAMPS =====

0:00 — Introduction and Requirements
0:33 — Preparing the 3D Scene in Blender
1:08 — Setting Up the 3JS Project
1:50 — Detecting Mouse Hover with Raycasting
2:58 — Identifying Hovered Objects and Flipping Cards
3:13 — Running the Project and Final Demo
3:30 — Wrap Up