# Particle speed vs. world speed

in X-Particles, particles can have two different speeds: their own, inbuilt speed, and the 'world' speed. Most of the time, these are the same but sometimes they are not. There are certain circumstances in which the world speed is very useful. So what is the difference between the two?

#### Particle speed

This is the speed given to the particle the emitter when it is created. It can be altered in a large number of ways, of which the various modifiers such as Speed, Gravity, etc. are the commonest.

If you need to, you can test a particle's speed with the Question object set to Particle Data->Speed, and carry out actions as a result.

Another item of data which is derived from the speed is the distance the particle has travelled, which can also be tested by a question.

In most cases, this all works as desired but there is one special case in which it will not work - testing the speed of particles stuck to the object from which they are emitted.

The problem in this case is that stuck particles are regarded as unmoving (which they are, in relation to their source object). Because they aren't moving their speed value is never updated - it remains at what it was on creation. In addition, the distance travelled is calculated from the particle speed over time, so will either increase if the particle speed is greater than zero, or will remain at zero if the particle speed is zero.

Consider what happens if a particle is emitted from an object and is stuck to that object by setting the 'Stick Particle to Source Object' switch in the emitter. If that particle is given a speed of 150 units by the emitter then if you test its speed it will come back as 150 units - even if the object is not moving at all in the scene. The particles will not move until they are unstuck, when they will move with the speed given to them.

One thing you might want to do is test the speed of the particle and unstick it, if the speed exceeds a given value. Since the speed is already 150 units, the question might well unstick the particles instantly on emission - rather negating the whole point of sticking them in the first place. But if you set the speed to zero in the emitter to get round this, you will find that you can never unstick them since the speed never increases past zero (and the distance travelled does not do so either).

To solve these problems, you need the world speed.

#### World speed

The world speed is the actual speed of the particle in the scene, calculated using the difference in global position of the particle over time. If the particle is stuck to an object which does not move, the world speed remains at zero. If the object does move, the world speed will change to reflect that, even if the particle's own speed was set at zero on emission. In addition, the world speed data also includes the world distance travelled, which again is derived from the changes in the particle's global position over time.

#### Unsticking stuck particles

You can now see how to unstick particles which are stuck to a source object if you want to test their speed. These are the required steps:

1. Enable the collection of world speed (and world distance travelled) data by checking the 'World Speed' switch in the emitter's Extended Data tab.

2. Add a Question object and set it to the 'Particle Data->Speed (World)' type, then enter the values you want to test.

3. Add an 'Unstick From Source' action to the question object.

With this setup, as the object moves the world speed will change and if the conditions in the question are met, it will be unstuck from the object.

#### Refinements

There's a little more we can do with this. Instead of world speed, we can test the world distance travelled. To do this, in step 2 set the question type to 'Particle Position->Distance Travelled' and then set the 'Recorded Distance' to 'World'. (The other option is 'Local to Particle' which tests the distance calculated from the particle's inbuilt speed.) That's all you need to do.

One further issue is what speed and direction the particle should have when it is unstuck. Each particle has a speed and direction assigned to it when created. For stuck particles, these will not change as the source object moves, so when they are unstuck they may have a speed and/or direction quite different from the stuck object. This may or may not be what you want. If you want that to happen, in the Unstick from Source action ensure that 'Use Original Velocity' is checked. But if you would like the particle to have the speed and direction the source object has at the moment the particle is unstuck, uncheck this switch. The menu which becomes available lets you specify if the particle is to receive the object's speed and direction, speed only (keeping the original direction), or direction only (keeping the original speed).

#### Summary

With the world speed and distance you should now be able to unstick particles from the source object depending on their speed or distance travelled,which will not work with the inbuilt particle speed and distance.