10-06-2025, 01:19 PM
Hi!
I like to spawn particles at the start of a surface and move them along the surface following the U-coordinate of the surface.
See image attached - the particles shall follow that helix.
I tried different approaches.
I used a Mapping operator to give particles the corresponding U coordinate of the surface, but I can't animate that.
I tried it with a script controller with help of ChatGPT, but there is always something in the script which the script controller doesn't know)
I searched for a way inside a speed operator to use surface coordinates as direction, but couldn't find.
I tried with a path follow instead, but I never can find good values so that particles really follow a path accurately.
Can someone tell me how that is possible??
Here is one of the scripts I tried. (But in this one, "particles" wasn't known to the script controller)
public void SimulationStep()
{
float speed = 0.2f;
foreach (var p in particles)
{
Vector2 uv = p.MappingOverride;
uv.X += speed * tpf; // tpf = time per frame
if (uv.X > 1.0f)
uv.X = 0.0f;
p.MappingOverride = uv;
p.Position = p.GetPositionFromMap(1, uv);
}
}
I like to spawn particles at the start of a surface and move them along the surface following the U-coordinate of the surface.
See image attached - the particles shall follow that helix.
I tried different approaches.
I used a Mapping operator to give particles the corresponding U coordinate of the surface, but I can't animate that.
I tried it with a script controller with help of ChatGPT, but there is always something in the script which the script controller doesn't know)
I searched for a way inside a speed operator to use surface coordinates as direction, but couldn't find.
I tried with a path follow instead, but I never can find good values so that particles really follow a path accurately.
Can someone tell me how that is possible??
Here is one of the scripts I tried. (But in this one, "particles" wasn't known to the script controller)
public void SimulationStep()
{
float speed = 0.2f;
foreach (var p in particles)
{
Vector2 uv = p.MappingOverride;
uv.X += speed * tpf; // tpf = time per frame
if (uv.X > 1.0f)
uv.X = 0.0f;
p.MappingOverride = uv;
p.Position = p.GetPositionFromMap(1, uv);
}
}