Skip to main content

Module cloth_rope

Module cloth_rope 

Source
Expand description

Cloth, rope, and soft body game integration for Chaos RPG.

Provides Verlet-based cloth simulation (ClothStrip), chain-based rope physics (RopeChain), spring-mass soft body blobs (SoftBodyBlob), and concrete game-entity wrappers (boss capes, tendrils, robes, soul chains, slime enemies, quantum blobs, weapon trails, pendulum traps, chest lids).

All types use glam::Vec3 for 3D positions and reuse constraint-solving patterns from crate::physics::soft_body.

Structs§

BossCape
A cloth strip attached to a boss entity. Anchor points (top row) follow the boss position. Responds to vortex fields and movement.
ClothId
Identifies an instance within the manager.
ClothRopeManager
Central manager owning all active cloth, rope, and soft body instances. Steps all each frame, removes expired ones, and provides render data.
ClothStrip
A rectangular grid of Verlet-integrated point masses connected by distance and bend constraints, simulating cloth or fabric.
DistanceConstraint
A rigid distance constraint between two point indices.
HydraTendril
A rope chain connecting two hydra split instances. The tendril can be severed when enough damage is dealt to the connection point.
NecroSoulChain
A rope connecting a necromancer to a recently killed enemy. Dark energy particles flow along the chain. The chain breaks when the enemy is too far or the soul is consumed.
PendulumTrap
A pendulum trap using a rope chain with a fixed top point. Swings under gravity and damages entities on contact with the weighted end.
PlayerRobe
2-3 short cloth strips for the mage class, swaying with player movement.
QuantumBlob
A soft body that oscillates between two shapes (Eigenstate boss mechanic). The frequency can be configured and represents the quantum superposition oscillation.
RopeChain
A chain of point masses connected by distance constraints, forming a rope.
RopeId
SlimeEnemy
A soft body blob that deforms on hit, jiggles, and reforms. Lower HP results in more wobbly behavior (lower spring stiffness).
SoftBodyBlob
A spring-connected mesh of points forming a deformable 2D blob (circle of perimeter points plus a center point).
SoftBodyId
TreasureChestLid
A simple hinge implemented as a two-segment rope. The hinge point is fixed, and the lid swings open when interacted with.
VerletPoint
A single Verlet-integrated point mass used by cloth and rope systems.
WeaponTrail
A chain of segments that follows a weapon swing path. On impact, segments compress (bunch up) then relax back.

Constants§

MAX_CLOTH
Maximum number of active instances per type.
MAX_ROPES
MAX_SOFTBODIES