- Home /
How to calculate a particle's potential maximum total velocity?
Hopefully this makes sense.
I'm trying to work out what an emitted particle's maximum velocity.magnitude could be.
I have a particle system prefab from Unity's asset pack with a collider surrounding the emitter. A script is attached to the collider that basically iterates through the list of collision events of the emitted particles and in this case gets the particle's "totalVelocity.sqrMagnitude".
flameTriggerData[flameTriggerDataIDX].sqrMagnitude = p.totalVelocity.sqrMagnitude;
"p" being an emitted particle that has collided with the collider.
This works fine, but I'm aiming to then normalise these values between the range of 0.0 - 1.0, in which case I need the maximum possible value.
With particle.totalVelocity being the sum of particle.velocity and particle.animatedVelocity I'm not sure what values/parameters in the particle system modules to take into account. The manual gives some examples but doesn't seem the note all modules that have an effect on totalVelocity.
Anyone know the best method to work this max value out?
Thanks.
Answer by richardkettlewell · Apr 16, 2018 at 07:18 PM
Any module that moves the particles, will affect the value. Velocity over life, force over life, velocity by speed, limit velocity, noise, collision.. and a few settings in the main module.
Some modules eg collision and limit velocity only reduce the speed, you may wish to ignore those.
It’s probably quite hard to calculate the max possible speed robustly by inspecting these properties, perhaps consider running an offline script in your build process to simulate the systems and record the max speed. Then save that value with each system? Just a thought :)
Your answer
Follow this Question
Related Questions
Particle Velocity Decay/Slow Down? 1 Answer
How is Limit Velocity Over Lifetime calculated? 0 Answers
How does particle.velocity relate to the particle's actual velocity? 2 Answers
Can you change the Velocity Over Lifetime of a Particle System using a Script? 3 Answers
How to make an effect in a particle system so that it is always behind the sphere? 1 Answer