Game Development Reference
In-Depth Information
( v i +2 v i ) · d i =0 ,
which expands to
P i +1 1
v i +1 ) d i +1 +P i +2 d i +2 ·
d i +1
m i +2
1
m i +1
( v i +2
m i +2 +
+P i d i− 2 ·
d i− 1
m i
=0 .
This makes the equation system tridiagonal, and such systems happen to have
a linear time-exact solution [Wiki 10a]. Collisions can be handled in this method
by just projecting contact vertices' velocities to the contact plane whenever they
occur in equations.
Of course, this again requires cheating one's way around the inherent comple-
mentarity of the problem (since separating velocities don't need to be projected
back to the plane). It gets worse when friction, especially static, is introduced (dy-
namic friction can just be applied independently before the solver). One standard
solution is to make an assessment of how a vertex will behave after the solver pass
based on its initial condition and then solve a respective linear problem (namely—
no constraints for would-be separating vertices, plane projection for sliding, and
full lock for those held by static friction). Naturally, it's possible to make sev-
eral iterations of this step. In general though, for shorter (10-20 segment) ropes
it might be advisable to use a simple iterative linear complementarity problem
(LCP) solver instead (which can have correct friction and separation), and switch
to the direct method for longer ones, where artifacts in individual vertex motion
are less visible and vertex behavior can be better predicted based on the current
state of it and its neighbors.
Another interesting point about free-hanging ropes is that it's possible to cal-
culate the final resting pose if the endpoints and the total length are known. This
can be very useful when placing things like power cables on a game level, since
knowing the exact resting pose means the rope will not suddenly start swaying
when the player comes close. Despite a moderately common misconception that
this slack curve is a parabola, in actuality, it's a special curve type, called “the
catenary” [Wiki 10b]. It does look similar to a parabola, but if we want a per-
fectly still resting pose, we'd better use the real thing. An interesting side note
about the catenary is that it is also (unsurprisingly) shaped as an arch that can sup-
port its weight with no sliding forces between the stones (which means no cement
is needed). Once we know the shape's parameters, we can place the vertices at
equal distances with this formula:
Search Nedrilad ::




Custom Search