Pluralsight Rigging A 2D Character In Unity Using IK
Download ->>> https://urllio.com/2tvzMF
How to Rig a 2D Character in Unity Using IK
In this article, we will learn how to rig a 2D character in Unity using inverse kinematics (IK), a technique that allows us to control the position and orientation of a joint by specifying the desired end point of a chain of bones. We will use the free tools offered by Unity 2020, such as the Sprite Editor, the 2D Animation package, and the 2D IK package. We will also learn how to integrate particle systems with sprites, create custom rigging components, and animate a 2D character walk cycle that adapts to uneven terrain.
What You Need
To follow along with this article, you will need:
A Unity account and the Unity Hub installed on your computer.
A Unity project with the 2D Animation package and the 2D IK package installed. You can create a new project and install these packages from the Package Manager window.
A 2D character sprite sheet that you want to rig. You can use your own sprite sheet or download one from the internet. For this article, we will use the Pluralsight course assets by Shane Whelan.
Step 1: Slice the Sprite Sheet
The first step is to slice the sprite sheet into individual sprites that we can use for rigging. To do this, we will use the Sprite Editor tool in Unity.
Import your sprite sheet into your project by dragging and dropping it into the Assets folder.
Select your sprite sheet in the Project window and set its Texture Type to Sprite (2D and UI) in the Inspector window.
Click on the Sprite Editor button to open the Sprite Editor window.
In the Sprite Editor window, click on Slice in the top left corner and choose Automatic from the drop-down menu. This will automatically detect and slice the sprites based on their alpha values.
Click on Apply in the top right corner to save your changes and close the Sprite Editor window.
You should now see your sprite sheet sliced into individual sprites in your Assets folder.
Step 2: Create a Sprite Skin
The next step is to create a sprite skin for your character. A sprite skin is a component that allows us to attach bones to sprites and animate them using IK.
Create an empty game object in your scene by right-clicking on the Hierarchy window and choosing Create Empty.
Rename this game object to Character or whatever you want to call your character.
Add a Sprite Skin component to this game object by clicking on Add Component in the Inspector window and searching for Sprite Skin.
Drag and drop one of your sliced sprites (preferably one that shows your character's full body) into the Sprite field of the Sprite Skin component. This will be your character's base sprite.
You should now see your character's base sprite in your scene view.
Step 3: Create Bones
The next step is to create bones for your character. Bones are game objects that have a Bone component attached to them. They define the structure and hierarchy of your character's skeleton.
Select your character game object in the Hierarchy window and click on Edit Bones in the Sprite Skin component. This will enable you to create bones for your character in the scene view.
Create a root bone for your character by clicking anywhere on your character's base sprite. This will be the parent of all other bones.
Create child bones for each body part of your character by clicking on an existing bone and dragging outwards. You can adjust the position and length of each bone by dragging its end point or its center point. You can also rotate each bone by holding down Ctrl (or Cmd on Mac) and dragging its end point.
Name each bone according to its body part by selecting it in the Hierarchy window and changing its name in the Inspector window aa16f39245