# \#ray

**URL:** https://forum.babylonjs.com/tag/ray/137.md

[Latest](https://forum.babylonjs.com/latest.md) · [Categories](https://forum.babylonjs.com/categories.md) · [Tags](https://forum.babylonjs.com/tags.md)

---

## [How does ray.intersectsTriangle work?](https://forum.babylonjs.com/t/how-does-ray-intersectstriangle-work/61399)

<div class="topic-metadata">

**Author:** [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Replies:** 9\
**Last updated:** [November 13, 2025, 8:11am UTC](https://forum.babylonjs.com/t/how-does-ray-intersectstriangle-work/61399 "2025-11-13T08:11:37Z")

</div>

Hi everyone, Please see this playground: Babylon.js Playground (or take this one without context; just the ray/triangle: Babylon.js Playground). The overall code might still be wrong. I have been adapting it from AI. B…

---

## [Wrong result of PickingInfo.getNormal with thin instances](https://forum.babylonjs.com/t/wrong-result-of-pickinginfo-getnormal-with-thin-instances/57393)

<div class="topic-metadata">

**Author:** [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Replies:** 5\
**Last updated:** [March 26, 2025, 11:02am UTC](https://forum.babylonjs.com/t/wrong-result-of-pickinginfo-getnormal-with-thin-instances/57393 "2025-03-26T11:02:12Z")

</div>

OS: any Engine: any Version: 5.57.1 ~ 7.54.1 Playground: Steps to reproduce: Click the plane Look at the lines Expected: Normals should be perpendicular to the plane Actual: Code:

---

## [Can we trust y position of createPickingRay?](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354)

<div class="topic-metadata">

**Author:** [@ylacaute](https://forum.babylonjs.com/u/ylacaute)\
**Replies:** 2\
**Last updated:** [March 23, 2025, 3:22pm UTC](https://forum.babylonjs.com/t/can-we-trust-y-position-of-createpickingray/57354 "2025-03-23T15:22:17Z")

</div>

I have a flat ground. On mouse move, I use createPickingRay to get the ground mesh position at the mouse pointer and move a sphere at this position. The sphere is always correctly positionned, so I think there is no bug…

---

## [Walking on Snow](https://forum.babylonjs.com/t/walking-on-snow/50520)

<div class="topic-metadata">

**Author:** [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Replies:** 12\
**Last updated:** [February 22, 2025, 1:55am UTC](https://forum.babylonjs.com/t/walking-on-snow/50520 "2025-02-22T01:55:22Z")

</div>

Hello :slight\_smile: I was working on updating some geometry, based on some Ray Casting process… And I ended up with this funny Playground, so I share :grin: It’s based on a very simple trick : For each ground vert…

---

## [Raycasting over pmx model? Does it work?](https://forum.babylonjs.com/t/raycasting-over-pmx-model-does-it-work/54237)

<div class="topic-metadata">

**Author:** [@CornelioD](https://forum.babylonjs.com/u/CornelioD)\
**Replies:** 7\
**Last updated:** [October 22, 2024, 10:07am UTC](https://forum.babylonjs.com/t/raycasting-over-pmx-model-does-it-work/54237 "2024-10-22T10:07:08Z")

</div>

Hi, its been years since I resumed my work with babylonjs hyped by the new MMD support. My Idea was to be able to make an VR/XR video editor so for example i can record action using my mmd model. I was trying to pose a m…

---

## [How can I make a curved ray?](https://forum.babylonjs.com/t/how-can-i-make-a-curved-ray/53802)

<div class="topic-metadata">

**Author:** [@Alecell](https://forum.babylonjs.com/u/Alecell)\
**Replies:** 1\
**Last updated:** [September 27, 2024, 1:52pm UTC](https://forum.babylonjs.com/t/how-can-i-make-a-curved-ray/53802 "2024-09-27T13:52:16Z")

</div>

Hey, I have a pretty specific case here that I need to use a curved raycast, but seems like this is not something usual, was wondering if thats possible or the possible strategies to kinda emulate that behavior …

---

## [Adding a predicate to select thin instance in ray picking function](https://forum.babylonjs.com/t/adding-a-predicate-to-select-thin-instance-in-ray-picking-function/52766)

<div class="topic-metadata">

**Author:** [@SSR](https://forum.babylonjs.com/u/SSR)\
**Replies:** 7\
**Last updated:** [September 17, 2024, 5:39pm UTC](https://forum.babylonjs.com/t/adding-a-predicate-to-select-thin-instance-in-ray-picking-function/52766 "2024-09-17T17:39:58Z")

</div>

I am using thin instances in my project to improve the performance and it has been very helpful! However, there are some instances I wish to exclude from the ray picking. Currently, the pick function only accepts a norm…

---

## [ArcRotateCamera Target Screen Offset Issue with Raycast in Third-Person View](https://forum.babylonjs.com/t/arcrotatecamera-target-screen-offset-issue-with-raycast-in-third-person-view/52785)

<div class="topic-metadata">

**Author:** [@ertugrulcetin](https://forum.babylonjs.com/u/ertugrulcetin)\
**Replies:** 7\
**Last updated:** [August 15, 2024, 9:37pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-target-screen-offset-issue-with-raycast-in-third-person-view/52785 "2024-08-15T21:37:56Z")

</div>

I’ve set my ArcRotateCamera’s targetScreenOffset to Vector2(0, -1) to position my third-person character. To prevent the camera from clipping through obstacles, I’m using raycasting. The raycast is functioning correctly…

---

## [Adjusting Raycasting for Camera Target Offset](https://forum.babylonjs.com/t/adjusting-raycasting-for-camera-target-offset/52645)

<div class="topic-metadata">

**Author:** [@ertugrulcetin](https://forum.babylonjs.com/u/ertugrulcetin)\
**Replies:** 2\
**Last updated:** [August 9, 2024, 9:22pm UTC](https://forum.babylonjs.com/t/adjusting-raycasting-for-camera-target-offset/52645 "2024-08-09T21:22:27Z")

</div>

I need to cast a ray from the character’s position to the camera, while considering a target screen offset Vector2(-0.5, -1). Without the offset, the ray correctly goes through the screen’s center, but with the offset a…

---

## [Sample code for moving along a slope!](https://forum.babylonjs.com/t/sample-code-for-moving-along-a-slope/51492)

<div class="topic-metadata">

**Author:** [@kotaro36](https://forum.babylonjs.com/u/kotaro36)\
**Replies:** 0\
**Last updated:** [June 20, 2024, 2:25pm UTC](https://forum.babylonjs.com/t/sample-code-for-moving-along-a-slope/51492 "2024-06-20T14:25:45Z")

</div>

It’s not finished yet, but give the demo a try! demo

---

## [Raycast keeps hitting even changing its origin](https://forum.babylonjs.com/t/raycast-keeps-hitting-even-changing-its-origin/50972)

<div class="topic-metadata">

**Author:** [@Alecell](https://forum.babylonjs.com/u/Alecell)\
**Replies:** 3\
**Last updated:** [May 31, 2024, 6:00pm UTC](https://forum.babylonjs.com/t/raycast-keeps-hitting-even-changing-its-origin/50972 "2024-05-31T18:00:13Z")

</div>

Hey all, I have a raycast on this playground but Im not able to make it stop hitting, the way I coded that (look to the Physics class) the ray position should get updated when I move my mesh, but for some reason it just …

---

## [Bakcover Edge wrapping issue](https://forum.babylonjs.com/t/bakcover-edge-wrapping-issue/50148)

<div class="topic-metadata">

**Author:** [@Rahul\_Verma](https://forum.babylonjs.com/u/Rahul_Verma)\
**Replies:** 13\
**Last updated:** [May 2, 2024, 5:44am UTC](https://forum.babylonjs.com/t/bakcover-edge-wrapping-issue/50148 "2024-05-02T05:44:42Z")

</div>

Hi guys. I got wrapping decal on backcover mesh edge during drop image event. But at the time of using resize handlers wrapping not working. can anybody help. I can share my relevant part of code.

---

## [pickWithRay misses front surface (triangle-corner?)](https://forum.babylonjs.com/t/pickwithray-misses-front-surface-triangle-corner/47829)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Replies:** 16\
**Last updated:** [February 10, 2024, 8:51pm UTC](https://forum.babylonjs.com/t/pickwithray-misses-front-surface-triangle-corner/47829 "2024-02-10T20:51:39Z")

</div>

Sometimes the function pickWithRay() misses the front surface of a connected object and rather picks the back: Note that rotating the sphere by 180 degrees around Y seemingly fixes it. This error leads to serous (some…

---

## [The problem when picking the Merged Mesh Thin Instance](https://forum.babylonjs.com/t/the-problem-when-picking-the-merged-mesh-thin-instance/45336)

<div class="topic-metadata">

**Author:** [@zhangyahan](https://forum.babylonjs.com/u/zhangyahan)\
**Replies:** 10\
**Last updated:** [November 4, 2023, 2:16am UTC](https://forum.babylonjs.com/t/the-problem-when-picking-the-merged-mesh-thin-instance/45336 "2023-11-04T02:16:46Z")

</div>

This problem bothered me for a long time. I used MergedMesh ThinInstance and Mesh ThinInstance to display the model information. The Mesh Thin Instance has no problem when picking, but the Merged Mesh Thin Instance alway…

---

## [What's the most effective method to ascertain if a vertex is within the camera's field of view (Front View)?](https://forum.babylonjs.com/t/whats-the-most-effective-method-to-ascertain-if-a-vertex-is-within-the-cameras-field-of-view-front-view/44886)

<div class="topic-metadata">

**Author:** [@SNM](https://forum.babylonjs.com/u/SNM)\
**Replies:** 2\
**Last updated:** [October 13, 2023, 4:56pm UTC](https://forum.babylonjs.com/t/whats-the-most-effective-method-to-ascertain-if-a-vertex-is-within-the-cameras-field-of-view-front-view/44886 "2023-10-13T16:56:52Z")

</div>

I’m searching for a method to determine whether a vertex lies within the camera’s field of view. Specifically, I want to identify vertices positioned on the visible front side while excluding the backside (backside view)…

---

## [Is it possible to calculate the ray from the center of an XR headset](https://forum.babylonjs.com/t/is-it-possible-to-calculate-the-ray-from-the-center-of-an-xr-headset/43574)

<div class="topic-metadata">

**Author:** [@Symbitic](https://forum.babylonjs.com/u/Symbitic)\
**Replies:** 1\
**Last updated:** [August 25, 2023, 5:01pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-calculate-the-ray-from-the-center-of-an-xr-headset/43574 "2023-08-25T17:01:37Z")

</div>

I’m working on an XR game that’s playable without a controller. As part of it, I need to calculate a ray from the center of the headset for firing a projectile. Is there any way of doing this?

---

## [Box-Shaped Raycast equivalent in BabylonJS](https://forum.babylonjs.com/t/box-shaped-raycast-equivalent-in-babylonjs/43190)

<div class="topic-metadata">

**Author:** [@DukeVen](https://forum.babylonjs.com/u/DukeVen)\
**Replies:** 2\
**Last updated:** [August 11, 2023, 1:18pm UTC](https://forum.babylonjs.com/t/box-shaped-raycast-equivalent-in-babylonjs/43190 "2023-08-11T13:18:34Z")

</div>

Hello, I am currently working on a basic First Person Controller along with some additional features such as jumping. For the jumping mechanism I need to detect whether my player mesh is touching the ground or not. A …

---

## [Cast ray with cloned camera](https://forum.babylonjs.com/t/cast-ray-with-cloned-camera/43191)

<div class="topic-metadata">

**Author:** [@HedwigAR](https://forum.babylonjs.com/u/HedwigAR)\
**Replies:** 2\
**Last updated:** [August 11, 2023, 1:10pm UTC](https://forum.babylonjs.com/t/cast-ray-with-cloned-camera/43191 "2023-08-11T13:10:55Z")

</div>

Hi! I’m trying to cast a ray from a camera different than the active one. The reason for this is that I’m doing some calculation in the background, by the time that’s done the camera position won’t be relevant anymore. …

---

## [Please help me, making precise mouse dragging for Havok physics meshes](https://forum.babylonjs.com/t/please-help-me-making-precise-mouse-dragging-for-havok-physics-meshes/41546)

<div class="topic-metadata">

**Author:** [@jamessimo](https://forum.babylonjs.com/u/jamessimo)\
**Replies:** 6\
**Last updated:** [June 17, 2023, 11:34am UTC](https://forum.babylonjs.com/t/please-help-me-making-precise-mouse-dragging-for-havok-physics-meshes/41546 "2023-06-17T11:34:58Z")

</div>

I want to drag meshes that are physics enabled, but I want to grab and move them on the exact area I pulled like so; ISSUE: this works by making a joint on the raycast area and the object. this works pretty well BUT I …

---

## [Ray intersection from the invisible (culled) side](https://forum.babylonjs.com/t/ray-intersection-from-the-invisible-culled-side/41545)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Replies:** 8\
**Last updated:** [June 14, 2023, 3:26pm UTC](https://forum.babylonjs.com/t/ray-intersection-from-the-invisible-culled-side/41545 "2023-06-14T15:26:27Z")

</div>

I am trying to show some ray-traced rays. For the actual tracing the main bits are worked out, but I am left with the trouble to find the ray intersections when leaving the mesh. I tried all kinds of tricks, like modify…

---

## [In VR mode, change the width and color of the handle light invalid](https://forum.babylonjs.com/t/in-vr-mode-change-the-width-and-color-of-the-handle-light-invalid/41558)

<div class="topic-metadata">

**Author:** [@pxim](https://forum.babylonjs.com/u/pxim)\
**Replies:** 6\
**Last updated:** [June 14, 2023, 5:15am UTC](https://forum.babylonjs.com/t/in-vr-mode-change-the-width-and-color-of-the-handle-light-invalid/41558 "2023-06-14T05:15:22Z")

</div>

In VR mode, change the width and color of the handle light invalid. DEMO：https://playground.babylonjs.com/#ABDDD6#57 VR Device: PICO NEO 3 @babylonjs/core: ^6.3.1 After this code is running, the handle light has n…

---

## [Moved extruded polygons don't intersect with rays?](https://forum.babylonjs.com/t/moved-extruded-polygons-dont-intersect-with-rays/40694)

<div class="topic-metadata">

**Author:** [@alex1998ander](https://forum.babylonjs.com/u/alex1998ander)\
**Replies:** 2\
**Last updated:** [May 11, 2023, 2:59pm UTC](https://forum.babylonjs.com/t/moved-extruded-polygons-dont-intersect-with-rays/40694 "2023-05-11T14:59:09Z")

</div>

Hello everyone, I found some weird behaviour with extruded polygons and rays. It seems that when you move an extruded polygon, somehow rays don’t intersect with the polygon at the new position and instead intersect with …

---

## [Bullet in flight](https://forum.babylonjs.com/t/bullet-in-flight/39188)

<div class="topic-metadata">

**Author:** [@renjianfeng](https://forum.babylonjs.com/u/renjianfeng)\
**Replies:** 2\
**Last updated:** [March 24, 2023, 1:09pm UTC](https://forum.babylonjs.com/t/bullet-in-flight/39188 "2023-03-24T13:09:18Z")

</div>

If you need to achieve a more realistic bullet effect, this example may be helpful for you. You do not want your weapon to be a laser gun that directly hits the target without delay, but rather the bullet of the weapon h…

---

## [PointerDragBehaviour to pick selected mesh](https://forum.babylonjs.com/t/pointerdragbehaviour-to-pick-selected-mesh/39285)

<div class="topic-metadata">

**Author:** [@Argha\_Chakraborty](https://forum.babylonjs.com/u/Argha_Chakraborty)\
**Replies:** 3\
**Last updated:** [March 24, 2023, 8:09am UTC](https://forum.babylonjs.com/t/pointerdragbehaviour-to-pick-selected-mesh/39285 "2023-03-24T08:09:59Z")

</div>

I am facing an issue with plane dragging. When the plane that I need to drag, gets inside some mesh, scene picker picks those meshes which the ray is intersecting in the very beginning. Thus when the plane gets trapped…

---

## [Unable to call ActionManager with castRay](https://forum.babylonjs.com/t/unable-to-call-actionmanager-with-castray/39162)

<div class="topic-metadata">

**Author:** [@bredd](https://forum.babylonjs.com/u/bredd)\
**Replies:** 3\
**Last updated:** [March 20, 2023, 5:52am UTC](https://forum.babylonjs.com/t/unable-to-call-actionmanager-with-castray/39162 "2023-03-20T05:52:32Z")

</div>

Hello, My playground: https://playground.babylonjs.com/#UGIGWU#37 I am trying to create a 3d version of hangman, and so far I have made a moveable character with a PointerLock. I have been using 26 box meshes as my con…

---

## [pickWithRay vs intersectsMeshes, best approach?](https://forum.babylonjs.com/t/pickwithray-vs-intersectsmeshes-best-approach/37497)

<div class="topic-metadata">

**Author:** [@mawa](https://forum.babylonjs.com/u/mawa)\
**Replies:** 13\
**Last updated:** [January 19, 2023, 11:17am UTC](https://forum.babylonjs.com/t/pickwithray-vs-intersectsmeshes-best-approach/37497 "2023-01-19T11:17:55Z")

</div>

Dears, I was for the first time looking into selecting meshes from a ray casted from a first-person camera. I managed to achieve my goal… but then, I’m a bit confused towards what is the best approach. In short, I cas…

---

## [Implement color picking](https://forum.babylonjs.com/t/implement-color-picking/36829)

<div class="topic-metadata">

**Author:** [@querielo](https://forum.babylonjs.com/u/querielo)\
**Replies:** 1\
**Last updated:** [December 23, 2022, 7:51pm UTC](https://forum.babylonjs.com/t/implement-color-picking/36829 "2022-12-23T19:51:41Z")

</div>

The previous topic: GPU picking demo To start a discussion about it I suggest to write the next classes: class Picker { private \_renderTarget: BABYLON.RenderTargetTexture; private \_selector: Selector; cons…

---

## [Ray can't turn in the right direction](https://forum.babylonjs.com/t/ray-cant-turn-in-the-right-direction/36784)

<div class="topic-metadata">

**Author:** [@musk](https://forum.babylonjs.com/u/musk)\
**Replies:** 3\
**Last updated:** [December 23, 2022, 1:08am UTC](https://forum.babylonjs.com/t/ray-cant-turn-in-the-right-direction/36784 "2022-12-23T01:08:57Z")

</div>

hey~all. Why the ray can’t turn in the right direction. when camera’s parent rotated. what did i miss ? pg: Babylon.js Playground

---

## [How to create a ray with rotation instead of direction?](https://forum.babylonjs.com/t/how-to-create-a-ray-with-rotation-instead-of-direction/35632)

<div class="topic-metadata">

**Author:** [@gunpowderfans](https://forum.babylonjs.com/u/gunpowderfans)\
**Replies:** 1\
**Last updated:** [November 12, 2022, 2:14pm UTC](https://forum.babylonjs.com/t/how-to-create-a-ray-with-rotation-instead-of-direction/35632 "2022-11-12T14:14:46Z")

</div>

To create a ray, it needs origin position, direction position and length. How to create it with rotation value (or rotation quaternion) instead of direction value?

---

## [False negative scene.pickWithRay pick.hit result](https://forum.babylonjs.com/t/false-negative-scene-pickwithray-pick-hit-result/32886)

<div class="topic-metadata">

**Author:** [@emp](https://forum.babylonjs.com/u/emp)\
**Replies:** 9\
**Last updated:** [September 14, 2022, 1:13pm UTC](https://forum.babylonjs.com/t/false-negative-scene-pickwithray-pick-hit-result/32886 "2022-09-14T13:13:06Z")

</div>

Hi. Use cannojs as phys engine. After upgrading to bjs 5.18.0 i register false negative results from scene.pickWithRay(). It gets some false results every ~1 second. It breaks movement logic. const pick = this.\_scene.pi…

[Next page](https://forum.babylonjs.com/tag/ray/137.md?match_all_tags=true&page=1&tags%5B%5D=ray)
