![]() |
XII Release 0.1.0
|
A simple simulator for swinging and hanging ropes. More...
#include <RopeSimulator.h>
Classes | |
struct | Node |
Public Member Functions | |
void | SimulateRope (const xiiTime &diff) |
void | SimulateStep (const xiiSimdFloat fDiffSqr, xiiUInt32 uiMaxIterations, xiiSimdFloat fAllowedError) |
void | SimulateTillEquilibrium (xiiSimdFloat fAllowedMovement=0.005f, xiiUInt32 uiMaxIterations=1000) |
bool | HasEquilibrium (xiiSimdFloat fAllowedMovement) const |
float | GetTotalLength () const |
xiiSimdVec4f | GetPositionAtLength (float fLength) const |
Public Attributes | |
xiiVec3 | m_vAcceleration = xiiVec3(0, 0, -10) |
External acceleration, typically gravity or a combination of gravity and wind. Applied to all rope nodes equally. | |
xiiDynamicArray< Node, xiiAlignedAllocatorWrapper > | m_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 |
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.