Skip to content

Debugging Tips

Some tips and tricks on how to debug your simulations.


Debugging Tips

Running into trouble? Can't figure out why something happens the way it does? Try these tips one by one, in the order they're written.


Test Ragdoll

For any of these tips to help you, we need to make sure Ragdoll is to blame.

debugscene

Python Script

from maya import cmds

for scene in cmds.ls(type="rdScene"):
    cmds.setAttr(scene + ".enabled", False)

This disables all Ragdoll scenes and should result in a non-simulated, clean version of your scene. If the problem persists, the problem is unlikely related to Ragdoll.

Still a chance

Your controls are still plugged into Ragdoll, and it's unlikely but possible that the problem isn't with the simulation but with the non-simulated parts of Ragdoll, like custom rotation orders, rotate pivots, scale and so forth. So keep an eye out for that!


Test Everything

Make sure no funny business is happening, this should result in in nothing happening when you press play.

  1. Disable Gravity
  2. Disable Collide on all Rigids
  3. Disable Limit Enabled on all Constraints
  4. Disable Guide Enabled on all Constraints
  5. Re-enable things, one by one until you find the culprit

Python Script

from maya import cmds

def set_attr(attr, value):
    """Some attributes are driven by another"""
    inputs = cmds.listConnections(attr, plugs=True, destination=False)
    while inputs:
        attr = inputs[0]

        # Keep walking until you find one that can be set
        inputs = cmds.listConnections(attr, plugs=True, destination=False)

    try:
        cmds.setAttr(attr, value)
    except Exception:
        print("Could not set %s" % attr)

for scene in cmds.ls(type="rdScene"):
    set_attr(scene + ".gravityY", 0.0)
    set_attr(scene + ".gravityZ", 0.0)

for rigid in cmds.ls(type="rdRigid"):
    set_attr(rigid + ".collide", False)

for constraint in cmds.ls(type="rdConstraint"):
    set_attr(constraint + ".limitEnabled", False)
    set_attr(constraint + ".driveEnabled", False)  # Another name for "guide"


Test Shapes

Overlapping shapes on the start frame can be a headache. Here's a quick and easy way of seeing whether that's a problem.

  1. Disable Gravity
  2. Disable Collide on all Rigids
  3. Re-enable things, one by one until you find the culprit

Python Script

from maya import cmds

def set_attr(attr, value):
    """Some attributes are driven by another"""
    inputs = cmds.listConnections(attr, plugs=True, destination=False)
    while inputs:
        attr = inputs[0]

        # Keep walking until you find one that can be set
        inputs = cmds.listConnections(attr, plugs=True, destination=False)

    try:
        cmds.setAttr(attr, value)
    except Exception:
        print("Could not set %s" % attr)

for scene in cmds.ls(type="rdScene"):
    set_attr(scene + ".gravityY", 0.0)
    set_attr(scene + ".gravityZ", 0.0)

for rigid in cmds.ls(type="rdRigid"):
    set_attr(rigid + ".collide", False)


Test Limits

Sometimes, limbs can begin outside of a permitted limit.

testlimits

Python Script

from maya import cmds

def set_attr(attr, value):
    """Some attributes are driven by another"""
    inputs = cmds.listConnections(attr, plugs=True, destination=False)
    while inputs:
        attr = inputs[0]

        # Keep walking until you find one that can be set
        inputs = cmds.listConnections(attr, plugs=True, destination=False)

    try:
        cmds.setAttr(attr, value)
    except Exception:
        print("Could not set %s" % attr)

for constraint in cmds.ls(type="rdConstraint"):
    set_attr(constraint + ".limitEnabled", False)


Test Guides

Sometimes, guides are responsible. They can be especial ly treacherous if you ask it to reach an angle exactly 180 degrees away from where it starts.

Python Script

from maya import cmds

def set_attr(attr, value):
    """Some attributes are driven by another"""
    inputs = cmds.listConnections(attr, plugs=True, destination=False)
    while inputs:
        attr = inputs[0]

        # Keep walking until you find one that can be set
        inputs = cmds.listConnections(attr, plugs=True, destination=False)

    try:
        cmds.setAttr(attr, value)
    except Exception:
        print("Could not set %s" % attr)

for scene in cmds.ls(type="rdScene"):
    set_attr(scene + ".gravityY", 0.0)
    set_attr(scene + ".gravityZ", 0.0)

for rigid in cmds.ls(type="rdRigid"):
    set_attr(rigid + ".collide", False)

for constraint in cmds.ls(type="rdConstraint"):
    set_attr(constraint + ".limitEnabled", False)
    set_attr(constraint + ".driveEnabled", False)  # Another name for "guide"

Last update: 2021-08-08