PhysX Switch - Turn Off Simulation

by John Rand from a scene file by Jeff Lim

Scene File: Max9_PhysXSwitch_TurnOffSimulation_Finished.max

This scene contains a wall made of individual bricks, a plane, a single animated spherical deflector, and a wind spacewarp to be used within the Particle Flow system. You will be knocking down the wall and rebuilding it. In the course of the the wall being knocked down the bricks will interact with some flexible columns.


Part 1 - Building and preparing the Wall


Open the file Max9_PhysXSwitch_TurnOffSimulation_Start.max

Play the animation.

Open Particle View (Keyboard Shortcut 6) to create a new particle flow system.

  • Create a new PhysX Flow - this flow will be used to create the wall
  • Remove the Shape operator
  • Remove the Spin operator
  • Replace the Birth operator with a Box#2 Birth Group operator
    • Add all of the boxes to the Birth Group
    • Press "Update Particles From Objects" button - this refreshes the operator to show your new particle shapes
    • Press the "Hide" button to hide your original geometry.
  • Add a PhysX Force operator
    • Add Wind01
    • Set the Exponent to 3 - This multiplies the effect by 10 to the third, PhysX forces need more force than standard pflow
    • Enable Time Warp and set it to 5 frames - This simply creates a burst of wind instead of a constant force
  • Click the PhysX World operator
    • Press the "=>" -Access Driver Parameters- button
    • In the modify panel notice the PhysX World Driver is now selected, scroll down to advanced parameters, open the rollout
    • Set the Subframe Factor to 18 - to increase system accuracy

Add a Particle Flow Collision Shape Modifier to the Plane01. Leave at default and enable the "Activate" button


Add a PhysX Collision test operator to event01 Add Plane01 to the test, configure as shown below.

Note: Always add PhysX Test Operators below the PhysX World Operator for them to function correctly


Add a PhysX Glue Operator above the PhysX Collision operator

  • Set the Binding Type to "Rigid"
  • Set the Bind Distance to 20.0 - Simplified/Rigid bind distance can be guesstimated by particle object center to particle object center
  • Tick Bind Center Aligned Only - this refers to axial alignment of adjacent particles, if within the set value, particles are considered aligned
  • Set Breakable by Force - we want the mortar to break
    • Max Force = 200000.0
    • Max Torque = 200000.0
  • In the "To Bind With" section tick Deflectors and Ground - this creates binds to deflectors as well as the ground
    • Add the object Plane01 to the deflectors list.

Add a Script operator below the Birth Group Operator. Edit the Script Operator as shown or grab the script HERE


The next section is straightfoward given that you are already familiar with Particle Flow. Mouse over the operators to see each operators settings. After duplicating the settings below this is how your flow should look

Brief description of operator settings:

Event 02:

  1. Collision Test - see if a particle has hit the Spherical deflector, if yes, continue and goto the next event
  2. Age Test - if particles have been in the event too long, send them out
  3. Spin - stop any spinnning
  4. Speed - stop any speed

Event 03:

  1. Age Test - hold the particles in this event for the specified duration then send them out

Event 04:

  1. Spin - give the particles some spin
  2. Find Target - since we gathered particle position data earlier in the flow with the "Store Data" Script operator we are now going to use that data with the Script Vector option in the Find Target parameters. This tells the Find Target operator to return the particles to value we saved in the particleVector channel or in other words the their original positions

Event 05:

  1. Go to Rotation - this tester will work with another Script operator we will add later, it will, over time, return the particles to their original orientation
  2. Speed - stop any particle speed

Inside Event 04 add a PhysX Switch Operator below the Find Target Test and Copy/Instance PhysX World from Event 01 below the PhysX Switch

In Event 05 add a new Script operator below the Go To Rotation Test. Rename it to "Rotation Script"

Brief Description of Settings:

  1. PhysX Switch - the physx switch gives you the opportunity to disable certain aspects of the PhysX World system. In this case we are making our particles match speed and spin and turning off the simulation. This gives control of the particles back to the standard operators without being influenced by the PhysX World system.
  2. PhysX World operators need to reside in every event you want to impart PhysX on your particles. You need to copy and paste or instance your original PhysX World operator to the new events. If you create a new PhysX World in subsequent events you will also be creating a new World Driver and your simulation will not be constistent. All PhysX Worlds in a flow need to be on the same World Driver in order for particles to interact.


Edit the Rotation Script Operator as shown or grab the script HERE


Part 2 - Adding the Columns


Create a new Birth Event with a Box#2 Birth Grid and wire PF Source 01 to the new Birth Event (Event 06)

  • Set the Grid Spacing to 10.0 - this amount defines the spacing between particles within the grid
  • Tick Non-Uniform Grid and set as follows:
    • Grid Length - 400.0
    • Grid Width - 300.0
    • Grid Height - 50.0
  • Change the Icon Size as follows:
    • Lenght - 200.0
    • Width - 150.0
    • Height - 100.0


Next add the following to the new Birth Event (Event 06)

  • Add a standard shape operator
    • Shape - Cube
    • Size - 5.0
  • Add a new PhysX Shape operator or copy the PhysX Shape operator from Event 01 to Event 01
  • Add a PhysX Drag operator and set the Dampening Factor:
    • Linear - 3.0
    • Angular - 1.5
  • Copy/Instance the PhysX World operator from Event 01 to Event 06
  • Set the Display Operator to Geometry


Add a PhysX Glue Operator

  • Set the Binding Type to "Simplified"
  • Set the Bind Distance to 10.0
  • Tick Bind Gap and set it to 1.0
  • In the "To Bind With" section tick Deflectors and Ground
    • Add the object Plane01 to the deflectors list.

Add a PhysX Collision test operator below the PhysX Glue test

  • Add Plane01 to the test


Play the Animation


With more going on in this scene you may choose to "Bake" your PhysX World. This ensures a smoother playback

Note: You should always "Bake" before rendering, this is a must if you choose to use Object Motion Blur :-)