How to set a relative position target to an absolute position source

Hi

I was wondering if it is possible to spawn the particle system to a position that is between force attractor and original Kinect position. As of now, it seems that the system spawns back to the original Kinect UV position at each frame, creating this flickering effect.

How do I debug this?

Hi @scarscarin ,

Full disclosure, I haven’t used Kinect so shooting from the hip here, take everything I say with a grain of salt :slight_smile:
Here’s what might be happening:

Update executes each frame.
At the start of the frame you:
1. Set the particle position
2. Add a force to the velocity attribute, this block does velocity += (Force / mass) * deltaTime;
3. At the end of each Update, there’s an implicit block (Integration: Update Position) which does the following: position += velocity * deltaTime;

So you’ll set the position, then at the end of Update it will move a bit based on your force and then at the beginning of the next frame you set it back to its original place which makes it snap back, which might cause the flicker that you see.

There might be other things with the setup, but this popped to mind. A few things you can explore:

  1. Moving your Set Position/Color/Alpha to Initialize so they are only set once, but can still independently travel with the velocity set via your force block without being re-set. You’ll also need to spawn them constantly and give them a small lifetime so they expire. This might however blur your overall look.

  2. Set the position directly in Initialize Once, and then do some easing in Update like this:

    This will move the existing position from the last frame towards the new position from your Kinect based on some easing value you specify, so it could alleviate the snapping.

You could also trying doing the movement towards the attractor in Output (without velocity, just some lerp) but you’ll need some timing value (like the age of the particle) and maybe some distance checks (so they don’t all move with the same speed).

Hope any of this might be of help or at least not get in the way of finding an actual solution! :slight_smile:

7118977--849775--upload_2021-5-7_18-30-52.png
7118977--849793--upload_2021-5-7_18-53-35.png

1 Like

Hah! It worked

Thanks @VladVNeykov !

1 Like