PhysX Shape Chain

by John Rand

Scene File: Max9_PhysXShape_Chain_finish.max

This scene contains two chain links, one vertical link (VertLink_01) and another horizontal link (HorzLink_01). This is a simple explanation on how to build and use concave shapes with Box#2.


Part 1 - Preparing the Scene and Chain Geometry


Open the file Max9_PhysXShape_Chain_start.max

Each link is built with 16 cylinder primitives each with a bend modifier set to 22.5 degrees ( 360 / 16 = 22.5 ). The cylinders are then grouped. These have been converted to an editable mesh (you can use editable poly, or simply group the cylinders) and attach the remaining 15 cylinders. These links are simple loops, you can create nearly any shape you like as long as you use the Birth Group Operator to birth the particle shapes. This is the only Birth Operator that gives you the option to separate particles by group, element, or parent.

NOTE: The HorzLink01 has a reset XForm applied, this is because it is a clone of VertLink01. Its World Space coordinates should be reset for Particle Flow to give an accurate creation of the Birth Group shapes.

The next step is to clone the links to the desired length. We will use the array tool.

  • Select the scene objects VertLink_01 and HorzLink_01
  • Menu >Tools > Array Tool
  • Type of Object - Instance
  • Array Dimensions - 1D - Select the amount of Link instances you wish to make, we will use the default of 10.
  • Enable Preview
  • Incremental - Move - X-axis - 48.25
  • Click OK
  • Delete the last horizontal link (HorzLink_10)

 

In the front viewport create a Cylinder

Keyboard entry:

  • X - 0.0
  • Y - 0.0
  • Z - negative 75.0 (-75.0)
  • Radius - 5.0
  • Height - 150.0

Add a Pflow Collision Shape Modify and activate

 

In the Top Viewport, shift+drag clone the Cylinder01 object and move along the X-axis to 435.0

 

 


Part 2 - Building the Flow with Box#2


Our scene geometry is now complete.

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

  • Drag a new PhysX Flow into the field
  • Remove the Shape operator
  • Remove the Spin operator
  • Create or drag a new Birth Group operator into Event01
  • Set the PhysX Shape operator to Type - Convex Hull
  • Shift + Drag Event01 to clone a copy - choose copy
  • Select Event01 Birth Group
    • Click By List
    • Select all of the "LinksHorz" geometry and click OK
  • Select Event02 Birth Group
    • Click By List
    • Select all of the "LinksVert" geometry and click OK
  • Add or append a new PhysX Collision test operator
    • Select both cylinders
  • 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 Sub-frame Factor to 10 -- to increase system accuracy, this is just a starting point
    • NOTE: a good rule of thumb for this setting, "Max Binds p/Particle" multiplied by 2 plus 2 or (MBP*2)+2

  • Rename the events to Horizontal Links and Vertical links

 

Next to confirm that we have setup the link shapes correctly do the following steps:

  • Select the PhysX Shape Operator
    • Set the 'Display As' to Shaded --the particle shapes should turn yellow and match the particles shape, if not the base shape object or the Birth Group have not been setup correctly
  • Go to the Birth Group
    • Uncheck Object Elements
    • Click Update Particle Shapes From Objects --If you setup correctly the links should now appear as a disk shape instead of a torus
    • Check Object Object Elements
    • Click Update Particle Shapes From Objects --to return back to the particle back to their original state

 

Next add a Glue to both Events

  • Add a PhysX Glue Test operator below the PhysX World -- to create binding, this will retain the links shape
    • Set the type to Rigid
    • Bind Distance - 12.0
    • Max Binds p/Particle - 4
    • Enable Visualize binding
  • Right-click the Glue Test and click copy
  • Right-click below the PhysX World operator in Event 02 (or the Vertical Links event if you renamed them) and click paste, choose copy
  • Select the Perspective Viewport and hit F3 to go into wireframe mode, you should now see your glue bindings

 

Play the animation

Notice the amount of bounce. This can be reduced with a PhysX Drag operator. This will behave much like a standard drag spacewarp by inducing drag on the particle surface slowing them down.

  • Add a PhysX Drag operator above the PhysX World
    • Enable Linear and set to 3.0
    • Set the Angular to 0.5
  • Right-click the PhysX Drag operator and click copy
  • Paste an Instance in Event 02 --The Instance clone will ensure that if you change either one of the PhysX Drag operators parameters that it is duplicated to the other operator, maintaining consistency.

Play the animation

The bounce has diminished significantly

 


Part 3 - Skinning the Links


We will use the Particle Skinner Modifier to skin the particle bones we just created.

Unhide Torus 01 and Torus02 from the Particle Skinner Layer in the Layer Manager.

Repeat the same steps with the Array Tool to create the original horizontal and vertical links.

Do the following steps after your have created the Particle Skinner geometry:

  • Open Particle View and select both Display operators and change the Type to None --you may leave these on for troubleshooting
  • Select Torus01 and right-click Convert to Editable Poly
    • Click Attach by list
    • Select all of the Torus Instances and click Ok
  • In the Modify Panel add a new Particle Skinner Modifier
    • Particle Flow Systems: By List add PF Source01
    • Distance Influence: Absolute 6.0
    • Tick 'Control By Inside Inclusion'
    • Enable Activate Skinning

 

 


Part 4 - Adding some collision objects


Open Particle View (keyboard shortcut 6)

  • Add a new Birth Event - Birth Grid operator and wire it to the PF Source Global Container
    • Emit time 50
    • Grid Base - Triangle
    • Grid Size - 20
    • Icon Size
      • Length - 40.0
      • Width - 200.0
      • Height - 40.0
  • Set the Display operator to Geometry
  • Add a Shape operator - Cube - 10.0
  • Add a Scale operator
    • Scale Factor - Untick Constrain Proportions
    • Set Y to 1600.0
  • Add PhysX Shape operator
    • Set Mass to By Value 500.0
  • Copy an Existing PhysX World and paste below the PhysX Shape
  • Go to the Top Viewport and select the Birth Grid Icon
    • Move the Icon to:
      • X - 200.0
      • Y - 0.0
      • Z - 200.0

Play the animation