1 like 0 dislike
403 views
The Velocity field is assigned automatically by the Evolver script, yes? Is it simply the vector from the previous Position to the current Position?
by jpryne (240 points)

2 Answers

1 like 0 dislike
 
Best answer

The 'Velocity' field of particles is created automatically when you add a physics evolver.

by default, it's set to 0 (no movement)

you can change it in the spawn-script, by doing, for example:

    Velocity = vrand();

this will set the velocity to a random unit vector (length = 1), therefore the particles will travel at 1 world unit / second.

if you do in the spawn script:

    Velocity = vrand() * 40;

They will travel at 40 world units / second along the velocity vector.

    Velocity = float3(10, 0, 1);

will make particles travel at 10 world units/second along the 'X' axis, and 1 unit/sec along the 'Z' axis, etc..

So, 'Velocity' isn't the vector between the previous position to the current position. you can get this vector in an evolve script by doing (assuming there's no gravity and no drag) "Velocity * dt", 'dt' being the timestep of the current simulation frame.

An evolver script in itself doesn't do anything to the velocity, unless you explicitely type a line of script that does something with it.

The main evolver that updates the velocity is the physics evolver. It will change velocity based on the ConstantAcceleration, Drag, VelocityFieldSampler, MassField, AccelField, ForceField, VelocityField, collisions, etc..

by Julien (35.2k points)
0 like 0 dislike
So, after a bit of experimentation, it appears the Velocity field is populated solely by the ConstantAcceleration attribute of the CParticleEvolver_Physics object. Please correct me or expand upon this if I'm wrong.
by jpryne (240 points)
You can set/modify it in spawner and evolver scripts yourself.
Like in spawner script you could give it initial velocity along z axis:
Velocity = float3(0,0,1);
Yes, that's right
...