Game Development Reference
In-Depth Information
x i = a sin h 1 [desired segment length]
a
,
+sinh x i− 1
a
y i = a cos h x i
a ,
where x is the horizontal coordinate, y is the vertical coordinate (i.e., the one
aligned with the gravity), and a is the curve's parameter. To find it, we must solve
this equation:
2 a sin h s
2 a = h
sin h tan h 1 L
where s is the horizontal distance between the endpoints, h is the vertical distance,
and L is the desired rope length. Unfortunately, it doesn't have an analytical
solution and has to be solved numerically. Small price for an ability to just know
the end result, though!
8.3 Strained Ropes
Now, what about strained ropes? We may notice that when a rope gets strained
along a line, it in essence creates a temporary constraint between the objects it's
tied to, one that is very similar to a frictionless contact (with the rope's direction
serving as a surface normal), with only two differences:
Each object has its own application point.
Instead of preventing the bodies from going towards each other, rope pre-
vents them from separating, which can be easily achieved by just choosing
the normal's direction appropriately (for instance, if contacts expect the
normal to go inside the first body, then the rope should have its “normal”
going outside).
The good thing here is that the rope can use a very large number of simulation
segments—they will never slow down the solver because it will never know about
them in the first place. Even if the number of segments is small, if they are
simulated as separate rigid bodies, they can still present a difficult heavy-light-
heavy scenario (unless they are not actually light compared to the other objects,
in which case it'll likely look wrong)—not the case with a dedicated constraint.
Search Nedrilad ::




Custom Search