How to do it...

To create a 2D sprite doll style animation, follow these steps:

  1. Import your character sprite sheet with all the body parts into Unity.
  2. Select the sprite sheet and go to its Inspector.
  3. Set the Sprite Mode to Multiple and click on the Apply button.
  4. Click on the Sprite Editor button to open the Sprite Editor.
  5. Click on the Slice button in the Sprite Editor. The Slice dialog will appear.
  6. Set the Type do Automatic.
  7. Click on the Slice button in the bottom of the Slice dialog.
  8. In the Sprite Editor, adjust all the pivot points of the character's body parts. Body parts will be rotated around those pivot points in our animation. Try to have the pivot points in the joints of the limbs, as shown in the following screenshot:
  1. Click on the Apply button in the Sprite Editor.
  2. Create an empty game object in the scene's Hierarchy and give it a descriptive name (Warrior in our example).
  3. Drag and drop all the body parts from your character sprite sheet onto Warrior game object (you have to drag and drop one body part at a time because dragging multiple sprites will create an Animation Clip).
  4. Rename the body parts for better clarity. In our example, we have HipsChestHeadFrontUpperArmFrontLowerArmFront HandBackUpperArmBackLowerArmBackHandFrontUpperLegFrontLowerLegFrontFootBackUpperLegBackLowerLeg, and BackFoot.
  5. Build a humanoid hierarchy from all the body parts in the scene's Hierarchy, with the Warrior game object as the root. In our example, the hierarchy looks like the following:
        Warrior | Hips | Chest | Head 
        Chest | FrontUpperArm | FrontLowerArm | FrontHand 
        Chest | BackUpperArm | BackLowerArm | BackHand 
        Hips | FrontUpperLeg | FrontLowerLeg | FrontFoot 
        Hips | BackUpperLeg | BackLowerLeg | BackFoot 
  1. Adjust the Order in Layer field for every Sprite Renderer component in every body part. In our example, body parts have this order:
0
BackUpperArm
1
BackLowerArm
2
BackHand
3
BackUpperLeg
4
BackLowerLeg
5
BackFoot
6
FrontUpperLeg
7
FrontLowerLeg
8
FrontFoot
9
Head
10
Chest
11
Hips
12
FrontUpperArm
13
FrontLowerArm
14
FrontHand
  1. Move the body parts to their "anatomical" positions to form the character, as shown in the following screenshot:
  1. Select the Warrior game object (the root game object containing all the body parts).
  2. Go to WindowAnimation.
  3. Create a new Animation Clip by clicking on the Create button in the Animation View.
  4. Make sure the record button is pressed (upper left corner of the Animation View).
  5. Animate the character by rotating its individual body parts.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.232.189