Skip to content

Search

رجوع
· وقت القراءة: 1 د

Follow controllers

follow3d and follow2d pull a body to a node's pose with rapier's PD or PID controller, and a ragdoll can chase its clip.

follow3d and follow2d pull a body to the pose of another node every fixed step, with the PD and PID controllers rapier ships.

Two cubes under gravity, each pulled to a wireframe sphere: the PD cube hangs below its sphere, the PID cube sits in its centre

  • target names the node. position_gain and velocity_gain are per axis, 60 and 0.8 by default, which closes a gap in about one step.
  • rotation_gain and spin_gain turn the body too. translation_axes and rotation_axes say what is pulled; in 2D follow_rotation is the one turn.
  • kind = "pid" adds integral_gain: the gap summed over time pushes back against a steady force. In the picture both cubes have position_gain 0.3, and only the PID one holds against gravity.
  • The sum is in the snapshot, so a rollback pulls the same way. node.follow3d.reset_follow() forgets it.
  • A ragdoll built with drive: "follow" puts a follow on every body, aimed at its bone, so the bodies chase the animation. Its follow table takes the same keys.
[nodes.follow3d]
target = "/World/Hand"
kind = "pid"
integral_gain = [1.0, 1.0, 1.0]