The Components of Physically Simulated Bodies
<< previous | Chapter 8. Physical Simulation | next >>

## The Components of Physically Simulated Bodies

### Changed in breve 2.0

The methods used for loading images have been changed from breve 1.x, so pay close attention to this section if you're updating your simulation from a previous version of breve.

In order to construct physically simulated agents, you'll need to be familiar with the components of physically simulated bodies. There are three main components used in physical simulations:

- Links, the basic building blocks of physically simulated objects

- MultiBodies, physical bodies made up of one or more Link objects (the section called “The MultiBody class”)

- Joints, rigid connections between Link objects (the section called “The Joint Class and its Subclasses”)

- Springs, flexible connections between Link objects (the section called “Using Springs”)

### The Link Class

The Link class is the basic building block of physically simulated objects. A link is simply a rigid body with a particular shape. Once a Link is created and associated with a shape, it can be attached to other links via Joint objects, covered in the section The Joint Class and its Subclasses (the section called “The Joint Class and its Subclasses”) or brought into the physical simulation by being associated with a MultiBody, as discussed in the section on using MultiBody objects (the section called “The MultiBody class”).

Prior to breve 2.0, Link objects would not appear in the simulated world unless they were associated with MultiBody objects (described below). This is no longer the case.

### The Joint Class and its Subclasses

As mentioned in the previous section (the section called “The MultiBody class”), Links are joined together using Joint objects.

There are several types of joints available—see each class' documentation for more details:

- FixedJoint

- PrismaticJoint

- RevoluteJoint

- UniversalJoint

- BallJoint

### The MultiBody class

A MultiBody is a single logical physically simulated agent, whether it is made up of a single Link, or multiple Links joined together with Joint objects.

The role of the MultiBody has changed drastically in breve 2.0 from previous versions of breve. Previously, Link objects would not appear at all in the simulated world unless they were part of a MultiBody. Now, the use of MultiBodies is completely optional.

Keeping a set of Links bound together as a logical MultiBody unit allows the user to move or rotate the entire logical structure, as opposed to moving or rotating individual links. Imagine that suddenly your arm was moved across the room without the rest of your body —in all likelihood, this would not make you very happy. This is what it's like for the underlying physics engine to move a single link—confusing and painful things can happen. By encompassing a set of connected Links within a MultiBody, the user has more logical control over the object.

To create a MultiBody, you can simply associate it with any existing Link object. The Link object you choose will be known as the root link, and all other Links connected to the root link—directly or indirectly—will become part of the MultiBody. The MultiBody is automatically updated as joints are created and destroyed.

<< previous | Up | next >>
Writing Stable Physical Simulations | Table of Contents | Dynamically Creating and Destroying Joints