Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Initialize and Freeze All Particles

Add the script to Simulation Flow (Ctrl/Cmd + F2) > SimulationPre.

The script freezes a particle volume at the beginning of the simulation (works with standard particle fluids only):

emitter = scene.get_PB_Emitter("Circle01")
particles = emitter.getParticles()

for particle in particles:
particle.freeze()

Unfreeze Particles

Add the script to Simulation Flow (Ctrl/Cmd + F2) > FramesPre or StepsPre.

The script unfreezes a particle (only works with standard particle fluids) when an animated object (here: "Sphere01") is 0.75 m or less away from the particle:

emitter = scene.get_PB_Emitter("Circle01")
particles = emitter.getParticles()
unfreezeObject = scene.getObject("Sphere01")
 
for particle in particles:
particlePosition = particle.getPosition()
objectPosition = unfreezeObject.getParameter("Position")
particleObjectDistance = particlePosition.distance(objectPosition)
 
if (particleObjectDistance <= 0.75): particle.unfreeze()
  • No labels