Skip to content

Collision Guide

akasaki1211 edited this page Jul 23, 2026 · 4 revisions

Collision Overview

collision_overview

Five types of colliders are supported: Sphere, Capsule, Infinite Plane, Mesh, and Ground.

The simulated bone section can collide in two ways:

Type Description Image
End sphere The default collision shape is a sphere centered at the end joint. Its radius is specified by the Radius attribute. end_sphere_collision
Bone-as-capsule (*Experimental) Enable boneAsCapsule to use a capsule from the start joint to the end joint.
rootRadius controls the radius of the start joint, and Radius controls the radius of the end joint.
⚠️This option supports only Sphere Colliders and Capsule Colliders.
bone_as_capsule_collision

If the Radius or collider is too small relative to the bone length, collisions may be missed and objects may pass through the bones. "Bone-as-Capsule" option addresses this issue.

bone_as_capsule

Visualizing Collision Shapes

Use boneDynamicsVisualizer to check collision shapes in the viewport.

# Add visualizer to all boneDynamicsNode
from maya import cmds
import bdn
for bd_node in cmds.ls(type='boneDynamicsNode'):
    bdn.create_visualizer(bd_node)

For details, see Visualizer.

Collider Connections

Collider connections are managed as arrays, allowing multiple colliders to be used simultaneously. Ground Collision does not require any connections.

In scripted workflows, bdn.connect_colliders() and bdn.disconnect_colliders() can be used to manage these connections. Supported inputs include dedicated collider transforms, mesh transforms, and compatible expcol collider nodes.

from maya import cmds
import bdn

# Create dedicated collider nodes
sphere_col, _ = bdn.create_sphere_collider()
capsule_col, _ = bdn.create_capsule_collider()
iplane_col, _ = bdn.create_infinite_plane_collider()

# Create poly torus (This is just a Maya mesh)
torus_mesh, _ = cmds.polyTorus()

# Connect colliders to all boneDynamicsNode
for bd_node in cmds.ls(type='boneDynamicsNode'):
    bdn.connect_colliders(
        bd_node,
        [sphere_col, capsule_col, iplane_col, torus_mesh],
        replace=True
    )

# Disconnect all boneDynamicsNode's colliders
for bd_node in cmds.ls(type='boneDynamicsNode'):
    bdn.disconnect_colliders(bd_node)

collider_connections

Primitive Collisions

Primitive colliders can be created with the dedicated collider nodes included in boneDynamicsNode.mll:

  • sphereColliderNode
  • capsuleColliderNode
  • infinitePlaneColliderNode

The recommended scripted setup is to create them through the bdn helper package:

import bdn

# sphere collider
sphere_col, sphere_shape = bdn.create_sphere_collider(
    radius=3
)

# capsule collider
capsule_col, capsule_shape = bdn.create_capsule_collider(
    height=10,
    radius_a=1.5,
    radius_b=2
)

# infinite plane collider
iplane_col, iplane_shape = bdn.create_infinite_plane_collider()

dedicated_collider

Colliders created with maya_expressionCollision (expcol) are still supported as compatible inputs.

from expcol import collider
collider.sphere()   # Sphere
collider.capsule()  # Capsule
collider.capsule2() # Capsule2 (Individually controllable radius)
collider.iplane()   # Infinite Plane

Tip

For primitive collisions, only simple numerical values such as "matrix" and "radius" are required as input. No shape information is needed. In the following GIF, the position of locator1 is used as the center of the sphere, and the Distance from distanceDimension is used as the radius. Collision is detected as if a sphere exists at that location. collider_note

Sphere

Use bdn.create_sphere_collider() to create a dedicated sphere collider node, and connect it using bdn.connect_colliders().

import bdn
sphere_col, _ = bdn.create_sphere_collider()
bdn.connect_colliders('boneDynamicsNode1', [sphere_col], replace=False)

For manual or low-level setups, connect the following attributes:

  • Sphere Col Matrix: Connect the worldMatrix of the sphere collider (used to obtain position and scale).
  • Sphere Col Radius: The radius of the sphere collider.

sphere

Capsule

Use bdn.create_capsule_collider() to create a dedicated capsule collider node, and connect it using bdn.connect_colliders(). This connects through capsuleColliderInput.

import bdn
capsule_col, _ = bdn.create_capsule_collider()
bdn.connect_colliders('boneDynamicsNode1', [capsule_col], replace=False)
  • Capsule Collider Matrix: Connect the worldMatrix of the capsule collider transform.
  • Capsule Collider Height: The capsule height.
  • Capsule Collider Radius A, Capsule Collider Radius B: The radius at each end of the capsule.

capsule_input

The legacy two-matrix capsule input is still supported for expcol-compatible:

  • Capsule Col Matrix A, Capsule Col Matrix B: Connect the worldMatrix of each end of the capsule collider (used to obtain position and scale).
  • Capsule Col Radius A, Capsule Col Radius B: Connect the radius for each end of the capsule collider.

capsule

Infinite Plane

Use bdn.create_infinite_plane_collider() to create a dedicated infinite-plane collider node, and connect it using bdn.connect_colliders().

import bdn
iplane_col, _ = bdn.create_infinite_plane_collider()
bdn.connect_colliders('boneDynamicsNode1', [iplane_col], replace=False)
  • Infinite Plane Col Matrix: Connect the worldMatrix of the infinite plane collider (used to transform the XZ plane).

infinite_plane

Mesh Collision (*Experimental)

mesh_collision

Any mesh can be used as a collider. However, compared to other collider types, mesh collisions are more computationally expensive and less stable, so their use is not recommended.

  • Mesh Collider: Connect the worldMesh of any mesh.
  • Mesh Col Cutoff: Max distance for mesh collision detection.

Note

  • This is an experimental feature and may be unstable.
  • All edges of the collision mesh should be set to soft edges.
  • Using a mesh with a large number of polygons will increase processing load.
  • If the collision mesh is not a closed shape, use Mesh Col Cutoff to control the detection range.
    mesh_col_cutoff

Ground Collision

This is a horizontal infinite plane collider. It can be used by simply enabling it and setting the ground height; no connections are required.

  • Enable Ground Col: Enable ground collision.
  • Ground Height: Height of the ground.

ground

Iterations

The Iterations parameter controls collision accuracy. The range is 0 to 10. Setting it to 0 disables collisions. Increasing the value improves accuracy, but may also increase computational load. A value around 5 is generally sufficient.

iterations

Clone this wiki locally