Setting the position of a particle, then releasing it

I’ve just watched Joregs Object Oriented Patching Node 20 course and learned a lot, I’ve been tinkering with trying to create a particle when you click the mouse button, and want it to follow the mouse while the left mouse button is down, and then when it is released, for it to take the last position, and then for its life to start counting down.

I think I’m close, but am missing something.

Basic Particle7.vl (34.1 KB)

Like this?
Basic Particle7.vl (38.1 KB)

I introduced another property to the particle to know if a particle is still “captured” by the mouse or already released.

1 Like

Yeah, that’s perfect!

Next iteration of this is that I want to make this work now for multitouch, I’ve almost got it I think, but something with the touch notifications isn’t quite correct, I’m using a reactive S+H to capture the notifications, then IsTouchDown and IsTouchUp to trigger the initial state, then the update.

Basic Particle - Multitouch.vl (92.5 KB)

there are different ways to do this. here is one:
Basic Particle - Multitouch.vl (100.1 KB)

please let me know if you have any further questions.

1 Like

This works so well, thanks you for you help!

I’ve been playing around with this and want to be able to use the same for stride particles, so trying to get this same patch working with Stride but am stumbling with how Stride deals with touch vs Skia.

For example, in Skia theres IsTouchDown, IsTouchMove, and IsTouchUp etc, but in Stride we have PointerPoint IsDown, but then you can feed Pressed Pointers, Down Pointers etc into it…

Basic Particle - Multitouch-Stride.vl (104.0 KB)

there are two differences in stride:

  • touches don’t come as events but we always get a full current state. ie we use normal foreach regions to loop over the three “pressed”, “down” and “up” pointer spreads
  • touch ids are not unique for the lifetime of your app, so we have to generate our own ids for the particles that are still living once a finger is removed
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.