Game Development Reference
In-Depth Information
Connecting the Center Node
One problem of the current setup is that it does not prevent the springs from expanding or
contracting too much. And, of course, the center node ought to be affixed to the entire
construct; otherwise, it may be squeezed outside the player.
You could use spring joints to connect the center with the circumference bodies, but you
already have springs set up with opposing circumference bodies. Additional spring joints
to the center won't affect the body much. In fact, either the opposing spring joints or the
ones connecting with the center would take precedence, making the others mostly useless.
It makes more sense to add distance joints to the center. That way, you can control the
minimum and maximum contraction of each circumference body from the center. This al-
lows you to take control of the overall deformability of the shape.
From the Node Library View , drag and drop eight distance joints onto the Player-
SoftBody.ccb stage. Connect the first joint with the center node and the right node. Contin-
ue connecting the other joints so that all connect with the center node as Body A and with
a circumference node as Body B —just like the spokes of a wheel.
Once you have all the joints connected, select each newly added distance joint in turn to
edit its properties. The Collide bodies check box should be checked, as there is a good
chance that the center body may collide with a circumference body. Allowing this colli-
sion to happen helps to avoid the problem where a circumference body may be pushed in-
ward past the center and then get stuck at the opposite side of the body. It may still hap-
pen, but it takes a lot more force to make it happen.
You should also enable the Minimum distance and Maximum distance check boxes, and
enter 24 as the minimum distance and 34 as the maximum distance. This gives the spring
joints some, but not too much, room to contract and expand. The result can be seen in Fig-
ure 10-12 .
Search WWH ::




Custom Search