# Picking particles in SPS bug

**URL:** <https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259>\
**Category:** Bugs\
**Created:** [December 5, 2022, 12:18am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259 "2022-12-05T00:18:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![splash27](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@splash27](https://forum.babylonjs.com/u/splash27)\
**Post date:** [December 5, 2022, 12:18am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/1 "2022-12-05T00:18:29Z")

</div>

Examples from this documentation page ([https://doc.babylonjs.com/features/featuresDeepDive/particles/solid\_particle\_system/picking\_sps](https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/picking_sps)) don’t work in BabylonJS 5 in playground. It starts to work if we switch to BabylonJS 4.  
Also, the links are messed up. A button that is supposed to lead to example without rotation, actually leads to example with rotation. And vice versa.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 5, 2022, 10:36am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/2 "2022-12-05T10:36:45Z")

</div>

Thanks for the feedback, this PR will fix the PGs inversion in the doc:

> <https://github.com/BabylonJS/Documentation/pull/722>
>
> See https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259

Regarding the picking problem, let’s cc @PolygonalSun:

I could trace the problem back to this modification:

This check:

```typescript
scene.onPointerObservable.hasObservers() || scene.onPointerPick || scene.onPointerDown

```

has been replaced by:

```typescript
this._scene.onPointerObservable.observers.length > this._cameraObserverCount || this._scene.onPointerPick || this._scene.onPointerUp

```

in this PR:

> <https://github.com/BabylonJS/Babylon.js/pull/13293/files#diff-745b65ff5eafe824c3c6d1595955b9eb97bcfa6cb29a90b084f1d7425336e4c8R267-R270>
>
> A user on the forums recently found an issue related to \`onPointerObservable\` wh…ere skipNextObservers weren't working as they used to. This issue was a side effect of an optimization make in support of Lazy Picking. This optimization would take all internal camera inputs and remove them from the user-facing \`onPointerObservable\`. This would cause the camera input observers to be inaccessible in the same way. This PR will add them back to \`onPointerObservable\` but keep track of how many camera input observers have been added and require either user-defined observer as part of the criteria for picking.
> 
> Forum Post: https://forum.babylonjs.com/t/no-longer-able-to-cancel-camera-inputs-with-new-oncamerainputobservable/35793

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 5, 2022, 11:31am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/3 "2022-12-05T11:31:16Z")

</div>

Assigned @PolygonalSun on December 5, 2022, 11:31am UTC



---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 5, 2022, 11:31am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/4 "2022-12-05T11:31:42Z")

</div>

@PolygonalSun it looks like this might be a regression, can you have a look ?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 5, 2022, 11:34am UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/5 "2022-12-05T11:34:11Z")

</div>

Definitely looks like a change in behavior here [Cameras: Modified cameras to work under onPointerObservable by PolygonalSun · Pull Request #13293 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/13293/files#diff-745b65ff5eafe824c3c6d1595955b9eb97bcfa6cb29a90b084f1d7425336e4c8R817)

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [December 5, 2022, 6:00pm UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/6 "2022-12-05T18:00:30Z")

</div>

I’ll take a look

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [December 5, 2022, 9:22pm UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/7 "2022-12-05T21:22:31Z")

</div>

Just an update, I found the root cause of the issue, it looks like a recent update changed the picking logic slightly. I have a fix for it and am currently writing some tests to prevent this from happening again. I’ll update you when I have a PR live.

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [December 6, 2022, 6:29pm UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/8 "2022-12-06T18:29:44Z")

</div>

PR is live: [InputManager: Update logic for detecting when to pick by PolygonalSun · Pull Request #13321 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/13321)

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [December 6, 2022, 9:31pm UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/9 "2022-12-06T21:31:01Z")

</div>

PR is merged

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [December 6, 2022, 9:31pm UTC](https://forum.babylonjs.com/t/picking-particles-in-sps-bug/36259/10 "2022-12-06T21:31:03Z")

</div>

Unassigned @PolygonalSun on December 6, 2022, 9:31pm UTC


