
MASH measures the velocity of all the points travelling in a network. To see the speed of your objects you can add a Points node and set the mode to Velocity, you will then see each point’s velocity printed in the viewport:

So how about a practical use for this, well, the Colour node has a build in ‘Use Velocity’ checkbox, which will use an object’s velocity as a multiplier for the colour, so slow objects are dark, and fast objects are bright.
But if you want to move on to something more complex, you need to add the Python node, rest assured, this couldn’t be easier.
The following script will scale objects according to their speed, it was used to produce the above animation.
- Add a Python node
- Copy and paste the script into it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import openMASH #initialise the MASH network data md = openMASH.MASHData(thisNode) #and this gets the number of objects in the network count = md.count() # scale the points depending on the velocity magnitude for i in range(count): md.outScale[i].x = md.velocity[i] md.outScale[i].y = md.velocity[i] md.outScale[i].z = md.velocity[i] #tell MASH to write the network data md.setData() |
The available channels are:
- md.velocity: A list of translational magnitudes (the speed of the point’s movement)
- md.angularVelocity: The same thing but for rotation.
- md.velocityVec: A tuple containing the magnitudes for each axis (x, y, z)
- md.angularVelocityVec: The same thing but for rotation.
Their corresponding output arrays (though I don’t know why you’d want to set these!) are:
- md.outVelocity
- md.outAngularVelocity
- md.outVelocityVec
- md.outAngularVelocityVec