Skip to content

Advanced Features

akasaki1211 edited this page Jul 23, 2026 · 4 revisions

Angle Limitation

You can specify the maximum angle by which a joint can rotate from its initial pose (including any Rotation Offset). Enable Angle Limit and set the desired angle (range: 0°–360°). The restriction forms a cone-shaped region.

angle_limit

Angle limitation takes precedence over collision. As a result, depending on the pose, joints may penetrate colliders.

penetrated_in_colliders

Visualizing Angle Limit

Use boneDynamicsVisualizer to visualize angle limits directly in the viewport. Create it with bdn.create_visualizer() or by passing create_visualizer=True to bdn.create_dynamics_node().

# 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.

Specify Target Pose

The rotation value connected to Rotation Offset is reflected as the initial (target) pose.
To have dynamics follow a target pose, duplicate the joint chain used for simulation (referred to here as the "target" chain) and connect the target's Rotate value to the Rotation Offset. When rotate the target chain, the dynamics will follow the target.

When using bdn.create_dynamics_node(), if you pass a target joint name to target_bone, the attributes will be connected at the same time the boneDynamicsNode is created.

import bdn
bdn.create_dynamics_node("joint1", "joint2", target_bone="joint1_target")

rotation_offset_connections

Tip

  • The twist component is not directly simulated and is applied instantly.
  • If Elasticity is set to 0, there will be no force returning the joint to the target pose, so this feature will have no effect.

The target chain can be keyframed. For example, this allows "the simulation to start from pose A, transition through pose B, and settle at pose C".

rotation_offset

Canceling Transform

To prevent certain nodes (such as a character's root controller) from affecting the simulation, connect their worldMatrix to the Offset Matrix attribute.

At each simulation step, the difference in this matrix is applied before physics calculations, effectively canceling only inertial motion. Collisions and other effects remain active. The Offset Matrix Weight attribute controls the influence. Important: All joints in the chain must have the same Offset Matrix Weight value to avoid unnatural behavior.

$o = p \cdot PrevOffsetMatrix^{-1} \cdot OffsetMatrix$
$p = lerp(p, o, weight)$

When using bdn.create_dynamics_node(), if you pass a node name to offset_node, the attributes will be connected at the same time the boneDynamicsNode is created.

import bdn
bdn.create_dynamics_node("joint1", "joint2", offset_node="offset")

offset_matrix_connections

offset_matrix

Tip

For example, if a character moves at high speed, dynamic objects may be pulled back strongly (lagging behind). By connecting the character root to the Offset Matrix, you can cancel out this high-speed movement.

Per-Section Scaling

By connecting the following three scale-related attributes, scaling can be supported for each section. If per-section scaling is not needed, these connections are not required.

  • Parent joint's Scale → Bone Scale
  • Parent joint's Inverse Scale → Bone Inverse Scale
  • Child joint's Scale → End Scale

When using bdn.create_dynamics_node(), passing scalable=True ensures that these attributes are connected at the same time the boneDynamicsNode is created.

import bdn
bdn.create_dynamics_node("joint1", "joint2", scalable=True)

Caution

Non-uniform scaling is not recommended, as it may produce unexpected results. The end joint receives the inverse scale from its parent, and "Segment Scale Compensate" must be enabled. This is usually satisfied if the joint was created using standard procedures.

scale_connections

scale

Tip

If the target pose is controlled using a duplicate joint, it is convenient to connect the scale from the duplicate joint as well. scale_from_target
When using bdn.create_dynamics_node(), pass connect_target_scale=True together with target_bone to connect scale from the target joint:

import bdn
bdn.create_dynamics_node(
    "joint1",
    "joint2",
    scalable=True,
    target_bone="joint1_target",
    connect_target_scale=True,
)

Even if these three scale attributes are not connected, the entire joint chain can still be scaled from a higher-level parent. However, non-uniform scaling is still not recommended in this case.

scale_parent

Branching

A single boneDynamicsNode is designed to handle "one section" of dynamics. By connecting multiple sections in sequence, branching structures can be supported without issue.

branching

However, if a joint has multiple children with different positions, it will have area (or volume) and will no longer be stick-shaped, making collision detection less reliable.

branching_skeleton
branching_skeleton_no_col

Sample Script: advanced_usage.py

advanced_usage.py is a bdn-based setup example for applying boneDynamicsNode to a selected joint chain. Select joints in order from root to tip, then run the script.

The current sample demonstrates the following workflow:

  • Creates one boneDynamicsNode for each adjacent joint pair in the selection.
  • Enables per-section scaling with scalable=True.
  • Connects a target joint such as {bone}_target through target_bone.
  • Connects target scale with connect_target_scale=True.
  • Connects an offset node to Offset Matrix when a node named offset exists.
  • Creates viewport visualizers with create_visualizer=True.
  • Uses Bone as Capsule with boneAsCapsule=True, rootRadius, and radius.
  • Uses the dedicated bdn collider helpers to create example sphere, capsule, and infinite-plane colliders when collider_grp does not exist.
  • Uses child transforms under collider_grp as the collider list when the group already exists.
  • Connects colliders through the colliders argument.
  • Connects a wind node to Additional Force when a node named wind exists.
  • Adds created nodes to boneDynamicsNodeSet.
bdn.create_dynamics_node(
    bone,
    end,
    scalable=True,
    target_bone=f"{bone}_target",
    connect_target_scale=True,
    offset_node="offset",
    create_visualizer=True,
    colliders=colliders,
    additional_force_node="wind",
    rootRadius=1.5,
    radius=1.5,
    boneAsCapsule=True,
    enableAngleLimit=True,
)

Clone this wiki locally