Spring is modeled as 2 point masses, linked by the spring
Equal but opposite force is applied to each end
Vector between the points is used to compute displacement and the direction of force:
v = point1 - point0 displacement = v.length() - restLength v.normalize() force = springConstant * displacement * v
Two classes needed: PointMass and Spring
Solid objects can be simulated as a collection of springs
Stiff springs (large spring constant) produce rigid objects.
Loose springs produce jello-like objects.
Often, additional internal springs are needed to keep a shape from collapsing
Cloth can be simulated by a mesh of springs
Diagonal springs are again useful, to keep the mesh from collapsing easily
Spring calculations are prone to "numerical explosion"
Possible solutions: |
|