Game Development Reference
In-Depth Information
Chapter
9
Physics Joints
In this chapter, you'll add more game elements to make the levels more fun to design and
play. Many complex physics objects require the use of joints. Joints are a means of keeping
individual bodies together, and they define the freedom of movement between the connec-
tions.
Physics objects like chains, ropes, and springs all require joints to operate. Joints are also
used to model soft-body physics. You will learn about this advanced technique in the next
chapter after I lay the foundation for joint editing in this chapter.
Joints can also be difficult to tame. They are the reason for most physics glitches observed
in games. Be it a horse and carriage suddenly launching high up in the air, ragdolls not
coming to rest and limbs constantly jittering, or complex bodies seemingly stretching to in-
finity or compressing to a fraction of the original size. Examples are aplenty.
What Are Joints?
A joint is an invisible physics object that connects exactly two bodies together. The joint
defines the connection points between the two bodies, called joint anchors . These anchors
should not be confused with a node's anchor point, which determines the node's texture
offset. The joint anchor is the point where the joint applies force to a body, which need not
be within the node's collision shape or texture.
Joints add constraints to two physics bodies. These constraints can force, for example, the
bodies to keep a fixed distance or a relative angle to each other.
The constraint parameters also determine how rigid the constraint is. Some constraints are
soft, allowing the bodies to move apart or closer to each other with only little force applied
to get them to their intended distance or rotation. Other constraints may be very rigid, al-
lowing very little tolerance in distance variation and thus applying a potentially enormous
amount of force to the bodies.
Search WWH ::




Custom Search