Knowledge Base
HomeProductsCommunityReviewsSocial
Toolkit for Unity
Toolkit for Unity
  • Welcome
  • Physics
    • Introduction
    • Ballistics
      • API.Ballistics
      • Ballistics Aim
      • Ballistic Path
      • Ballistic Path Follow
      • Ballistic Path Line Render
      • Ballistics Data
      • Ballistic Targeting
      • Trick Shot
      • Trick Shot Constant Acceleration
      • Trick Shot Line
    • Verlet Tools
      • Bezier Point
      • Scaled Animation Curve
      • Verlet (Static Class)
      • Verlet Line
      • Verlet Transform Node
      • Verlet Transforms
      • Verlet Transform Tree
      • Verlet Transform Tree Settings
    • Old KB
  • User eXperience
    • Introduction
    • Old KB
Powered by GitBook
On this page
  • Public Fields
  • Root
  • Settings
  • Ignore List
  • Nodes
  • Show Debug
  • Public Methods
  • Register Nodes
  • Add Force
  • Add Force at Position
  • Clear Forces
  • Reinitialise
  • Example Usage
  • Basic Setup
  • Runtime Force Application
  1. Physics
  2. Verlet Tools

Verlet Transform Tree

A simulation structure for animating hierarchical transforms using Verlet integration. Typically used for tails, ropes, chains, or foliage where child transforms follow dynamic, physics-based motion.

The VerletTransformTree defines and simulates a single transform hierarchy using Verlet physics. It handles node registration, per-frame simulation updates, and optional collision resolution based on settings curves. Each node retains a reference to its transform and original pose for positional and rotational constraints.


Public Fields

Root

public Transform root;

The root transform of the simulated hierarchy. All children (excluding those in ignoreList) will be registered as nodes.


Settings

public VerletTransformTreeSettings settings;

Reference to a VerletTransformTreeSettings asset that defines spring, damping, angle limits, drag, and collision curves based on depth in the hierarchy.


Ignore List

public List<Transform> ignoreList = new List<Transform>();

Any transforms to exclude from simulation. Useful for skipping specific branches of the hierarchy or static bone references.


Nodes

public List<VerletTransformNode> nodes = new List<VerletTransformNode>();

The list of simulated nodes in the hierarchy. Each node stores initial transform data and current simulation state.


Show Debug

public bool showDebug = false;

If enabled, node data and wire representations (capsules, links) will be drawn in the Scene view.


Public Methods

Register Nodes

[ContextMenu("Register Nodes")]
public void RegisterNodes()

Scans the transform hierarchy starting from root and populates the nodes list. Excludes any transforms in ignoreList.


Add Force

public void AddForce(Vector3 force)

Applies a global directional force to all nodes in the hierarchy.


Add Force at Position

public void AddForceAtPosition(float forceMagnitude, Vector3 position)

Applies a radial force from a given world position, diminishing by distance. Useful for explosions or impacts.


Clear Forces

public void ClearForces()

Clears accumulated external forces from all nodes.


Reinitialise

public void Reinitialise()

Resets all nodes to their original transform state and clears accumulated simulation data. Typically used after editing hierarchy structure in-editor.


Example Usage

Basic Setup

Attach a VerletTransformTree component to a GameObject and assign the root transform (e.g. a bone or empty parent).

Assign a VerletTransformTreeSettings asset to configure spring behaviour.

Optionally use the context menu "Register Nodes" to initialise the node hierarchy.


Runtime Force Application

public class TailWhip : MonoBehaviour
{
    public VerletTransformTree tree;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            tree.AddForce(Vector3.right * 5f);
        }
    }
}

This applies a one-time directional force to all nodes in the tree.

PreviousVerlet TransformsNextVerlet Transform Tree Settings

Last updated 15 days ago