I am struggling a bit with finding out what “Get Attribute: oldPosition” and “Get Attribute: position” exactly gives me.
So my Initial idea was the following. I have a particle system that can move and emits particle in worldspace. Unfortunately when moving to fast, some gaps appear in the spawning which makes it look uneven. So I thought when interpolating between oldPosition and position, i should have something like a continuous line. But it doesnt seem to work. either I am doing something wrong, or the oldPosition and position Values do not do what I expect.
I added a Property Binder to the game object and the correstponding properties in the VFX Graph. Then I replaced oldPosition and position with the values from the properties.
The difference, that I can see is, that I am using the default “Constant Spawn rate” block in the Spawn system.
I tried it with your setup and now it works for me too. But why is that? why does it make a difference, if I spawn the objects depending on distance rather than on a constant rate?
While I was writing this I was testing and found the answer. I tested to have both spawn blocks active and reduced the Rate in the “Spawn Over Distance” block to zero. now it is still working, which leads me to the conclusion that unity only sets these Values if it is using “Spawn Over Distance” (which makes kind of sense, since it probably needs them to calculate the distance).
But I think these Values should be still available when not using “Spawn Over Distance”.
Thanks also for the hint with the spawn index sequence. This helps, if I want the objects to be evenly spread.
You are mostly correct, to be more precise oldPosition is not set by default by any spawning system (I mean source location), so inheriting this value gives you nothing. You have to set it inside graph or outside graph or via spawner like spawn over distance.
From outside the graph you can do this via SendEvent("event", eventAttributes) event attributes, but you can do that inside the graph too by setting them in spawn context. Some more info here Spawn Over Distance is causing GC spikes
Thanks for the hint. To be honest, I already tried using the SetSpawnEvent blocks, but somehow it dind’t work. I guess I have done something wrong with the space. I am always a bit confused with world space and local space in vfx graph.