During Simulation
Add the script to Simulation Flow (Ctrl/Cmd + F2) > StepsPre.
...
New particles are being added to a standard particle fluid "Container01" node. Be aware that the number of particles can grow quickly, and we recommend using low-resolution objects for this example:
Code Block | ||
---|---|---|
| ||
import random rndNumber = random.uniform(-0.2,0.2) speedLimit = 2.5 emitter = scene.get_PB_Emitter("Container01") collisionObject = scene.getObject("Sphere01") if (len(collisionObject.getCollidingObjects()) > 0): vertices = collisionObject.getVertices() objectVelocity = collisionObject.getVelocity() for vertex in vertices: if (objectVelocity.module() >= speedLimit): vertexVelocity = vertex.getVelocity() vertexVelocity.scale(1.2 + rndNumber) emitter.addParticle(vertex.getPosition(), vertexVelocity) |
...