# Picking Solid Particles

> Learn how to pick and interact with solid particles in Babylon.js.

Source: https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/picking_sps

## Pickable Particles

You can make your particles pickable by using the `isPickable` parameter (default _false_) when creating your SPS:

```javascript
var SPS = new BABYLON.SolidParticleSystem("SPS", scene, { isPickable: true });
```

This sets the underlying mesh as pickable and populates two arrays called `SPS.pickedParticles` and `SPS.pickebBySubMesh`. So don't set your SPS as pickable if you don't need it to be, as this saves a lot of memory.  
To retrieve the particle picking data from these arrays, use the method `SPS.pickedParticle(pickingInfo)`, which returns an object with these properties:

- `idx` : the picked particle idx
- `faceId` : the face index of the picked particle (counted within this particle)

Example :

```javascript
var SPS = new BABYLON.SolidParticleSystem("SPS", scene, { isPickable: true });
// add shapes, build the mesh, init particles, etc
SPS.setParticles(); // initial SPS draw
SPS.refreshVisibleSize(); // force the BBox recomputation
scene.onPointerDown = function(evt, pickResult) {
  var meshFaceId = pickResult.faceId; // get the mesh picked face
  if (meshFaceId == -1) {
    return;
  } // return if nothing picked
  var picked = SPS.pickedParticle(pickResult); // get the picked particle data : idx and faceId
  var idx = picked.idx;                         
  var p = SPS.particles[idx];                   // get the actual picked particle
  p.color.r = 1; // turn it red
  p.color.b = 0;
  p.color.g = 0;
  p.velocity.y = -1; // drop it
  SPS.setParticles();
};
```

SPS pickability is directly related to the size of its bounding box (please read the 'SPS Visibility' part). So, to make sure your particles are pickable, remember to force the bounding box size to be recomputed at least once after the particles have been positioned in space with `setParticles()`.  
Pickable particle example (no SPS update in the render loop): [Playground: Pickable Solid Particles Example](https://playground.babylonjs.com/#2FPT1A#352) - Simple example showing how to make solid particles pickable.
Pickable particle example (particle rotation): [Playground: Pickable Solid Particles That Rotate](https://playground.babylonjs.com/#2FPT1A#351) - Simple example of picking solid particles that then rotate in the render loop.
