Plasma Engine  2.0
Loading...
Searching...
No Matches
plRopeSimulator Class Reference

A simple simulator for swinging and hanging ropes. More...

#include <RopeSimulator.h>

Classes

struct  Node
 

Public Member Functions

void SimulateRope (const plTime &diff)
 
void SimulateStep (const plSimdFloat fDiffSqr, plUInt32 uiMaxIterations, plSimdFloat fAllowedError)
 
void SimulateTillEquilibrium (plSimdFloat fAllowedMovement=0.005f, plUInt32 uiMaxIterations=1000)
 
bool HasEquilibrium (plSimdFloat fAllowedMovement) const
 
float GetTotalLength () const
 
plSimdVec4f GetPositionAtLength (float fLength) const
 

Public Attributes

plVec3 m_vAcceleration = plVec3(0, 0, -10)
 External acceleration, typically gravity or a combination of gravity and wind. Applied to all rope nodes equally.
 
plDynamicArray< Node, plAlignedAllocatorWrapperm_Nodes
 All the nodes in the rope.
 
float m_fDampingFactor = 0.995f
 A factor to dampen velocities to make the rope stop swinging. Should be between 0.97 (strong damping) and 1.0 (no damping).
 
float m_fSegmentLength = 0.1f
 How long each rope segment (between two nodes) should be.
 
bool m_bFirstNodeIsFixed = true
 
bool m_bLastNodeIsFixed = true
 

Detailed Description

A simple simulator for swinging and hanging ropes.

Can be used both for interactive rope simulation, as well as to just pre-compute the shape of hanging wires, cables, etc. Uses Verlet Integration to update the rope positions from velocities, and the "Jakobsen method" to enforce rope distance constraints.

Based on https://owlree.blog/posts/simulating-a-rope.html


The documentation for this class was generated from the following files: