Use Rigid Body Simulation to Create Collision Detection

 
 
 

This workflow demonstrates the rigid body simulation and collision detection between any two of the three objects.

  1. In a new Maya scene, set the Maya Time Slider duration to 100 frames and ensure it is set to play back at frame 1.
  2. Create a polygon plane by selecting Create > Polygon Primitives > Plane.
  3. Set the Width and Height to 20, and click Create.
  4. Convert the plane to a rigid body by selecting it and selecting Bullet > Create Passive Rigid Body > .
  5. In the Create Rigid Body Options window, change the Collider Shape Type from the default Box to Plane which is a better match.
  6. Create a polygon cube by selecting Create > Polygon Primitives > Cube.
  7. Set the Width, Height, and Depth to 2, and click Create.
  8. Position the cube by setting its Translate values to the following:
    • X: 0
    • Y: 1
    • Z: 0
  9. Create a polygon sphere by selecting Create > Polygon Primitives > Sphere. Set the Radius to 1 and click Create.
  10. Position the sphere by setting its Translate values to:
    • X: -10
    • Y: 1
    • Z: 0
  11. Convert the cube and sphere to rigid bodies by selecting them and selecting Bullet > Create Active Rigid Body.
  12. Select the cube and select its bulletRigidBodyShape node tab in the Attribute Editor.
  13. In the Rigid Body Properties section, set Friction to 0.1. This reduces the force due to friction that is currently acting on the object.
  14. Select the sphere and select its bulletRigidBodyShape node tab in the Attribute Editor.
  15. In the Rigid Body Properties section, set Friction to 0.1 and in the Forces/Impulses section, set Impulse along the X axis to 0.2.
  16. In the Collider Properties section, set Collider Shape Type to sphere. It is a good idea to match the Collider Shape type as closely to the shape you are using as possible.

Play back to the simulation. The Impulse attribute applies a force along the X axis causing the rigid body sphere to roll along the plane and collide with the cube, pushing it along.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License