All pastes #728758 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-07 10:14 UTC
rendered paste body
for( int i = 0; i < ConstrainedPoints.Count; i++ )
            {
                if( i < ConstrainedPoints.Count - 1 )
                {
                    Vector2 offset = ConstrainedPoints[ i + 1 ] - ConstrainedPoints[ i ];
                    Vector2 offsetDir = offset;
                    offset.Normalize( );

                    float displacement = offset.Length( ) - 50;

                    float K = 10.0f;

                    Vector2 force = offsetDir * displacement * K;

                    ConstrainedPoints[ i + 1 ] += force;
                 }
             }