Unpick particles in SPS

Hi everyone

I am trying to modify the SPS from the “Pickable Solid Particles Example”
So i managed to move the picked particles the distance i want with an input:

But i would like to delselect the particles, if i click them again.
Is that possible? Or is there a workaround? I tried quite some time, also searching for solutions, but noone mentioned this situation, so i feel like i missunderstand the SPS and it is not possible?

thx in advance

This is javascript logic here :slight_smile:

You should tag when picked/unpicked and you can do what you wish depending on the condition: https://playground.babylonjs.com/#58RDUA#1

If you want to come back to the previous color, you should store it on the particle as well.

1 Like

Thanx for the quick reply.
Actually my problem is the movement of the particles.
When i click on one and on the right top type “1” in the inputbox and press “enter” the particle moves 1 in x-direction.
But then i would like to move another one (and only this one).
So either when i press “enter” or when i click on it again i would like it to be “unpicked”.
My idea it to move every particle individually as i want.

edit when i now click on a particle and type “1” and “enter” it moves 1 unit in x-direction, when i click another particle and type “2” and “enter” it moves both 2 units in x-direction. So i would like to deselect the first one.

Same it is only code logic, nothing really Babylon specific.

What you want is having a currentParticle variable or field that will be set to the last picked one.

When pressing enter it is then easy to find it to deselect or move down.

1 Like