Game Development Reference
In-Depth Information
Figure 8.1. Sequential segment length enforcement. Here, black vertices represent the
initial state, and gray ones represent the state after length enforcement.
impulses applied along the rope segments to keep the relative vertex velocities
along these directions zero (we are assuming the rope has no contacts for now,
and also that it resists compressing as well as stretching—to make the problem
just linear instead of linear complementary):
v i = v i + d i P i
m i
,
d i P i
m i +1 ,
v i +1 = v i +1
( v i +1
v i )
·
d i =0 .
Here, v i is vertex i 's current velocity, v i is its updated velocity, d i is its
normalized direction from vertex i to vertex i +1, P i is the (scalar) impulse applied
to v i and v i +1 along d i ,andm i is the vertex i 's mass.
We can see that each impulse P i participates in only three neighboring equa-
tions (except for the border ones):
( v i
v i− 1 )
·
d i− 1 =0 ,
which expands to
P i 1
+P i− 2 d i− 2 ·
v i− 1 ) d i− 1 +P i d i ·
d i− 1
m i
1
m i− 1
d i− 1
m i− 1
( v i
m i +
=0 .
( v i +1
v i )
·
d i =0 ,
which expands to
P i 1
+P i− 1 d i− 1 ·
v i ) d i +P i +1 d i +1 ·
d i
m i +1
1
m i
d i
( v i +1
m i +1 +
=0 .
m i