10.12.2012 Views

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Moving a Kinematic Pair<br />

As discussed before, our snake will be a <strong>com</strong>posite object consisting of several connected<br />

<strong>com</strong>ponents that represent a kinematic chain. Kinematic chains are <strong>com</strong>posed<br />

of kinematic pairs: two rigid segments connected by a joint. How do<br />

kinematic pairs move and orient themselves? The basic idea is that the parent segment<br />

pulls the child segment. In a simple kinematic pair, the only restriction on<br />

movement is the joint. Because it’s the free end, the parent segment will move and<br />

rotate independent of the child. The child will strive to rotate and orient itself to face<br />

the joint, and move to keep up with its parent.<br />

Figure 6-7 shows a four-step sequence by which a parent segment will pull a child in<br />

a kinematic pair. Even though the parent pulls, the child segment does all the work.<br />

1<br />

Child<br />

Figure 6-7. Child segment keeping up with parent in a kinematic pair<br />

228 | Chapter 6: Composite Pattern<br />

C 1<br />

d<br />

3 4<br />

C 1<br />

Child<br />

Parent<br />

Parent<br />

P 1<br />

P 2<br />

P 1<br />

2<br />

C 1<br />

C 1<br />

Child<br />

Parent<br />

Child<br />

Parent<br />

C 2<br />

P 2<br />

P 2<br />

R<br />

P 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!