How to update the position of a spawned particle from GPU event collision?

I would like the particle to change its position based on where the collision takes place. Do I need to kill it and spawn a new?

Hi!
I’m not sure I understand the question, could you post an image of your VFX Graph?

My aim was here to spawn the particles from the collision and then update their position with the collisions position, keeping the same particles

GPU event source attributes are only available during Initialize, which is only run for new particles.
So, the short answer would be to try to spawn new particles, if it is possible.

However, if you are in U6, it would be possible to work around it with some HLSL and the Custom HLSL block:

  • Add an exposed GraphicsBuffer variable
  • On the source system, use a Custom HLSL block to find out if there was a collision and write data to the exposed GraphicsBuffer
  • On the child system, during Update, use another Custom HLSL block to check the GraphicsBuffer and update the position. You will need a way to identify the particle ID of the particles you want to update.

Again, I don’t recommend this approach, it is a bit cumbersome, and more work. But it is an option, if you really need it.

The main goal was to spawn particles from a texture read from pts file in script generating 35 million points. Hover mouse over a particle/point and make it highlight when clicked. And in the end make some different measurement functions. I made a raycast from mouse and then measure distance from all particles highlighting the closest one. This works however it takes a few moments. So I thought maybe the collision would be better performance wise.

Just today I tried with partitioning the particles at load time and only use that partition when measure distance. Its really effective so Im going this route instead. Thanks for the answers and input!

1 Like