Verlet Hierarchy

Like what your seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

Used by the Verlet Spring component to define a Verlet hierarchy.

Fields and Attributes

TypeNameComment

Transform

root

The root of the hierarchy. This node will not be moved but may rotate.

VerletHierarchySettingsReference

settings

Scriptab Reference for VerletHierarchySettings.

nodes

The list of particles managed by this system

List<Transform>

ignoreList

The transforms to exclude from simulation when registering particles

Vector3

restingVelocity

The constant velocity to remove from input velocity ... typically this is set as the local direction of acceleration of gravity when the system is at rest. This is typically only used by internal updates when the use resting flag is enabled in the VerletHierarchy settings.

Methods

Add Force

You can add additional forces to the hierarchy in one of two ways

public void AddForce(Vector3 force);

This will apply the force evenly to all nodes in the hierarchy and is useful for global forces such as wind, gravity and buoyancy.

public void AddForceAtPosition(float forceMagnitude, Vector3 position);

This is usefor for positional forces such as explosions.

Register Nodes

public void RegisterNodes();

This simply walks the transform hierarchy of the root attribute and creates VerletParticle entries for any transform that is not being ignored. This is typically only ever called on create and typically at development time in the Unity Editor but can be used at run time if needed.

ResetNodes

public void ResetNodes();

This is used to put all particles back to there initial states and is called when registering nodes at run time. In general it shouldn't need to be called manually.

Update

public void Update(Vector3 velocity, float time);

This is called by the Verlet Spring to update the system and generally shouldn't be called manually.

Note velocity is applied as a global effect scaled by the inert setting value, time is the step in time to be simulated and is typically the Fixed Delta Time but may be scaled to "tighten" the simulation.

Last updated