Skip to content

Tutorials · Animation and Cutscenes · Chapter 8

A marionette

35 minutes Uses: Bone, Sprite, PropertyAnimation

By the end

  • marionette, a node in the right wing at 1140, 288 with a control cross, three strings and a body of fourteen bones: a torso, a head, two arms of three and two legs of three
  • Every bone as long as its limb, with a Length, and its picture lying along it
  • scenes/marionette.propanim with a looping clip, dance: eight rotation tracks of five keys, the arms on Linear (angle) and the legs on Cubic (angle), and a RESET pose
On this page

The pieces

The theatre is about to get a third player. In the right wing, under the lantern, a marionette will hang from the puppeteer’s control cross. This part of the tutorial builds it. This chapter gives it a body of bones and a dance. Chapter 9 makes it dance, wave and breathe at once, chapter 10 reaches an arm for the lantern, and chapter 11 lets it fall when the knight cuts its strings.

A bone is a node with a length. Its picture is a Sprite, and the bone’s own turn is the picture’s: turn the upper arm and the arm turns, and the forearm, which is the upper arm’s child, goes with it. A rig moves a whole limb by turning one node.

The starter already holds the marionette’s ten pictures in art. None of them is on a node yet, so nothing is drawn:

PictureSizeIt is
puppet-bar.png40, 24the control cross: a crossbar over an upright
puppet-string.png1, 8a length of string, stretched to any length
puppet-torso.png22, 16the body: a blue tunic on a wooden frame
puppet-head.png14, 14the head, with painted eyes and cheeks
puppet-upper-arm.png14, 6the arm from shoulder to elbow
puppet-lower-arm.png12, 5the forearm
puppet-hand.png6, 6the hand
puppet-upper-leg.png16, 7the thigh, blue shorts at its top
puppet-lower-leg.png14, 6the shin
puppet-foot.png6, 10the foot; its sole is its right edge

Building the rig

The rig is built in the Hierarchy, parent above child, because a bone moves with its parent. It is a long list of nodes with the same few settings, so the steps below build one arm and one leg and duplicate them for the other side.

  1. Select theatre, click + Add node and choose Node. Rename it marionette: press F2, type the name and press Enter. Set its Position to 1140, 288. That is the right wing, with its soles on the boards.
  2. Select marionette, click + Add node and choose Sprite. Rename it bar and set its Position to 0, -105.3. Drag art/puppet-bar.png from Assets onto its Texture, and set Size to 40, 24, Anchor to 0.5, 1 and Sort Layer to 9.
  3. Select bar, click + Add node and choose Node. Rename it strings. It holds the three strings and moves nothing itself.
  4. Select strings, click + Add node and choose Sprite. Rename it string_head. Drag art/puppet-string.png onto its Texture and set Size to 1, 36, Anchor to 0.5, 0 and Sort Layer to 8.
  5. With string_head selected press Ctrl+D, and rename the copy string_left. Set its Position to -18.5, -9, its Rotation to -10.87 and its Size to 1, 63.6416. Press Ctrl+D on string_left, rename the copy string_right, and set its Position to 18.5, -9 and its Rotation to 10.87.

The strings hang from the cross’s two ends and its foot down to the marionette’s shoulders and the crown of its head. Now the body, bone by bone, starting with the torso, which every other bone hangs from.

  1. Select marionette, click + Add node and choose Sprite. Rename it torso. Set its Position to 0, -55.3 and its Rotation to 90, so that its bone points down from the neck. Drag art/puppet-torso.png onto its Texture and set Size to 22, 16, Anchor to 0, 0.5 and Sort Layer to 6.
  2. With torso selected click Add component and choose BoneComponent. Set its Length to 21.5.
  3. Select torso, click + Add node and choose Sprite. Rename it head, set its Rotation to 180, so that its bone points up, and give it art/puppet-head.png, Size 14, 14, Anchor 0, 0.5 and Sort Layer 7. Add a BoneComponent and set its Length to 14.
  4. Build the left arm the same way, each bone a Sprite and a BoneComponent, each under the one before. upper_arm_left goes under torso at 3.5, 6.5, lower_arm_left under it at 13, 0 and hand_left under that at 11, 0. The pictures, sizes and lengths are in the table below, and every arm bone takes Anchor 0, 0.5 and Sort Layer 7.
  5. Select upper_arm_left and press Ctrl+D. The copy brings its two children with it, still called lower_arm_left and hand_left. Rename the three upper_arm_right, lower_arm_right and hand_right, and set the copy’s Position to 3.5, -6.5, the right shoulder.
  6. Build the left leg: upper_leg_left under torso at 21.5, 3.5, Rotation 6.88; lower_leg_left under it at 15, 0, Rotation -13.75; foot_left under that at 13, 0, Rotation 6.88. Each leg bone takes Anchor 0, 0.5 and Sort Layer 5. The turns bend the knee a little outward, so the legs stand rather than hang.
  7. Select upper_leg_left, press Ctrl+D, and rename the three copies upper_leg_right, lower_leg_right and foot_right. Set the copy’s Position to 21.5, -3.5, and turn the three the other way: Rotation -6.88, 13.75 and -6.88.
  8. Select marionette and press F. The Viewport frames the whole rig: a node that draws nothing is framed by what its children draw.
The editor with marionette selected and framed. The Hierarchy at the left lists the rig under marionette, every node open: bar, with strings and its three strings string_head, string_left and string_right, then torso with head, upper_arm_left, lower_arm_left, hand_left, upper_arm_right, lower_arm_right, hand_right, upper_leg_left, lower_leg_left, foot_left, upper_leg_right, lower_leg_right and foot_right. The Viewport shows the marionette large, hanging from its wooden control cross by three strings, a wooden figure in a blue tunic with its arms down and its feet together on the boards, a small square handle at its feet. The Inspector shows its Node, with Position x 1140.0 and y 288.0, and a PropertyAnimationComponent, which the next section adds
The finished rig, framed. Its Property Animation is the next section’s.

The rig as built, bone by bone. Every picture is art/puppet-<name>.png; every bone is a Sprite with Anchor 0, 0.5 and a BoneComponent.

The bones

BoneUnderPositionRotationPictureSizeSort LayerLength
torsomarionette0, -55.390puppet-torso.png22, 16621.5
headtorso0, 0180puppet-head.png14, 14714
upper_arm_lefttorso3.5, 6.50puppet-upper-arm.png14, 6713
lower_arm_leftupper_arm_left13, 00puppet-lower-arm.png12, 5711
hand_leftlower_arm_left11, 00puppet-hand.png6, 675
upper_arm_righttorso3.5, -6.50puppet-upper-arm.png14, 6713
lower_arm_rightupper_arm_right13, 00puppet-lower-arm.png12, 5711
hand_rightlower_arm_right11, 00puppet-hand.png6, 675
upper_leg_lefttorso21.5, 3.56.88puppet-upper-leg.png16, 7515
lower_leg_leftupper_leg_left15, 0-13.75puppet-lower-leg.png14, 6513
foot_leftlower_leg_left13, 06.88puppet-foot.png6, 1056
upper_leg_righttorso21.5, -3.5-6.88puppet-upper-leg.png16, 7515
lower_leg_rightupper_leg_right15, 013.75puppet-lower-leg.png14, 6513
foot_rightlower_leg_right13, 0-6.88puppet-foot.png6, 1056

The bar, its strings and the marionette

NodeUnderFieldValue
marionettetheatrePosition1140, 288
barmarionettePosition0, -105.3
Texturepuppet-bar.png
Size40, 24
Anchor0.5, 1
Sort Layer9
stringsbarevery fieldas it comes
string_headstringsTexturepuppet-string.png
Size1, 36
Anchor0.5, 0
Sort Layer8
string_leftstringsPosition-18.5, -9
Rotation-10.87
Size1, 63.6416
string_rightstringsPosition18.5, -9
Rotation10.87
Size1, 63.6416

The two side strings take the same Texture, Anchor and Sort Layer as string_head, from the copy. Every other field of every node is as it comes.

The Bone

torso selected, its Inspector narrowed with the search box, bone, to its BoneComponent: Length 21.50, Rest Position x 0.0 and y 0.0, Rest Rotation 0.00 and Rest Scale x 1.0 and y 1.0, with the buttons Capture rest pose and Reset to rest under them. The Viewport shows the torso close up, a blue tunic on a wooden frame, and a thin violet kite, its bone, running from a square handle at the top of the torso down to a small blue square at its tip
Length
The Bone’s Length: how long the bone is, in local units, measured along its own x from its node to its tip. It is drawn in the Viewport as the kite in the picture above. The marionette’s are each the distance from its joint to the next one down the limb, a little shorter than its picture, since the pictures overlap at the joints (the foot’s is its picture’s whole width): 21.5 for the torso, 13, 11 and 5 down an arm and 15, 13 and 6 down a leg. Here nothing reads them yet. Chapter 10’s IK measures a limb’s reach by them, and a Bone added with no length set is 32.
Rest Position
The Bone’s Rest Position: where the bone sits when nothing is holding it out of place, in the units of its parent. It starts at 0, 0, and stays there in this chapter. Capture rest pose fills it in from where the bone stands, in chapter 11, and Reset to rest puts the bone back there.
Rest Rotation
The Bone’s Rest Rotation: the turn it returns to, in radians, 0 as it starts. It shows radians where the node’s own Rotation above it shows degrees: a quarter turn is 1.5708 here and 90 there. Many of a component’s own angles, like this one, are in radians; a few show degrees as the Transform does, such as a framing’s Rotation on the camera rig of chapter 12. Chapter 11 captures it.
Rest Scale
The Bone’s Rest Scale: the size it returns to, 1, 1 as it starts, which no bone of this marionette changes. Chapter 11 captures it with the rest.

The four rest rows are the pose a bone returns to once something lets go of it. Nothing does yet, so they stay as they came until chapter 11, where the marionette falls and has to stand up again.

A dance on its bones

The dance is a property clip, as the curtain’s rise was in chapter 3, with one difference: its tracks are not on the node that plays it. The Property Animation goes on marionette, and the Properties mode is marionette’s, since a bone has no clip of its own. The clip keys the Rotation of eight of the bones under it, by name, and every row reads the bone’s name before the property. The arms swing and the legs kick: the arms swing out in turn, half a second apart, and the knees kick in turn, a second apart.

  1. Select marionette, click Add component and choose PropertyAnimationComponent.
  2. In the Animation tab at the bottom, open the Properties mode, and press New property clips. It writes scenes/marionette.propanim and points Clips at it.
  3. Press the + beside the clip tabs, type dance and press Enter.
  4. In the Property Animation set Clip to dance, tick Playing and set Looping to Loop. Leave Speed at 1.
  5. Turn Record on: the toggle in the row with the Play button, beside Capture RESET.
  6. Take the table below a bone and a time at a time. Type the time into the time box, 0.00 s, beside the Play and Stop buttons, and press Enter. Select the bone in the Hierarchy. In the Inspector, under Node, type its Rotation for that time, in degrees, and press Enter. The tab goes on showing the marionette’s clips while a bone is selected, and the edit lands in the open clip as a key at the playhead.
  7. A bone’s first key makes its row, and the row begins on Linear. On each arm’s row open the interpolation menu and choose Linear (angle). On each leg’s row choose Cubic (angle).
  8. Press Capture RESET. It writes a clip called RESET with one key, at 0, on each of the eight rotations: the arms hanging at 0 and the legs at the stance you built them in. It writes the values the bones were built with, wherever the playhead stands, and not the pose the dance gives them there.
  9. Turn Record off, press Save in the bar, which writes marionette.propanim, and press Ctrl+S.

The clip is 2 seconds long, because its last key is at 2: the Properties mode cannot make a clip longer than its last key. The turns, in degrees as the Inspector takes them:

BoneMode00.511.52
upper_arm_leftLinear (angle)11.4680.2111.4680.2111.46
lower_arm_leftLinear (angle)034.38034.380
upper_arm_rightLinear (angle)-80.21-11.46-80.21-11.46-80.21
lower_arm_rightLinear (angle)-34.380-34.380-34.38
upper_leg_leftCubic (angle)6.8826.936.886.886.88
lower_leg_leftCubic (angle)-13.75-42.4-13.75-13.75-13.75
upper_leg_rightCubic (angle)-6.88-6.88-6.88-26.93-6.88
lower_leg_rightCubic (angle)13.7513.7513.7542.413.75

The left arm is out at 0.5 and 1.5, the right at 0 and 1; the left knee kicks at 0.5 and the right at 1.5. The hands, the feet and the head have no track, so they hold the pose their parents give them. The legs’ keys start from their stance, not from 0: a kick is a turn away from standing, and back.

While Record is on, a value you type in an Inspector row of marionette or of any bone under it is not an edit of that node. It is a key, in the open clip, at the playhead. The bone keeps the turn it was built with, and the Inspector and the Viewport show the clip’s pose with the new key in it. The edit makes the row if the clip has none, amber until Capture RESET has put it in the neutral pose, and replaces the key if there is one at that time. A rotation is typed in degrees, and the file keeps radians.

Some rules of the road. A key whose value is the one the bone already shows is an edit that changes nothing, and nothing is keyed: the first key of lower_arm_left is 0, which is what it shows, and the legs’ keys that repeat their stance are the same. Type another number first and then the one you want. The second edit replaces the first, at the same time. (Chapter 3’s double-click on a lane keys what the bone shows now, which here is the dance’s pose, so it does not help.) A button, a drag in the Viewport and a change in the Hierarchy are never keyed. The tab’s own Undo takes back one key, and Ctrl+Z is the scene’s and leaves the clip alone. And while Record is on, a value typed into any row of the marionette or its bones is keyed, while this mode is on screen, so turn it off when the keys are in.

The editor with head selected and the Animation tab raised to the middle of the window, on its Properties mode, the header reading marionette and the Record toggle lit, with the Save button lit. The clip tabs are dance, lit, and RESET, and the playhead reads 0.50 s. Nine rows: the eight bones’ rotations, upper_arm_left rotation to lower_leg_right rotation, and under them a ninth, head rotation, in amber, on Linear, with one diamond at 0.5. The Inspector shows head, its Rotation 137° with a small revert arrow beside it, its Position x 0.0 and y 0.0, and its BoneComponent with Length 14.00. The Viewport shows the head very close up, turned, with its blue outline and its bone drawn in violet
Record in use, shown on the head, which the dance does not turn: with head selected and the playhead at 0.5, a Rotation set in the Inspector made a ninth row, head rotation, with one key. The dance does not keep it.
The editor with marionette selected and the Animation tab raised to the middle of the window, on its Properties mode. The clip tabs are dance, lit, and RESET; the playhead reads 0.50 s. Eight rows, named by bone, upper_arm_left rotation, lower_arm_left rotation, upper_arm_right rotation, lower_arm_right rotation, upper_leg_left rotation, lower_leg_left rotation, upper_leg_right rotation and lower_leg_right rotation, the four arms on Linear (angle) and the four legs on Cubic (angle), each with five diamonds at 0, 0.5, 1, 1.5 and 2 on a ruler, and a red line at 0.5. The Viewport above shows the marionette at that moment on its cross, its left arm raised and the left knee lifted. The Inspector shows its Property Animation: Clips marionette.propanim, Clip dance, Playing ticked, Speed 1.00, Looping Loop
The Properties mode on marionette: each row is one bone’s Rotation, named by the bone, and the Viewport shows the clip at its playhead, 0.5.

The dance as built

NodeComponentFieldValue
marionetteProperty AnimationClipsmarionette.propanim
Clipdance
Playingticked
LoopingLoop
marionette.propanimclip dancelength2 s
tracksthe eight rotations in the table above
clip RESETlength0 s
tracksthe eight rotations, the arms at 0, the legs at 6.88, -13.75, -6.88 and 13.75

Every other field is as it comes.

Check it works

Eight frames of the marionette side by side, each on its cross with its three strings, the boards at the foot of every frame. In the first its right arm is stretched out at the right of the picture and the left hangs down. In the second and fourth both arms are out to the sides; in the third the left arm is out and raised at the left of the picture, the right arm hangs and the left knee is lifted. The fifth is the first again. In the seventh the left arm is out, the right arm hangs and the right knee is lifted, and the last is the second again
The dance in eight frames, 15 steps, a quarter of a second, apart: steps 360 to 465 of the run, 6 to 7.75 seconds in, which are the clip’s own 0 to 1.75. The clip repeats every 2.