Tutorial

Loading the Tutorial Scene

First, create a new project for the tutorial to load the tutorial scene. Kinesis comes with a simple scene for the purposes of this tutorial under the path Kinesis/Demo/Scenes/TutorialScene.unity, which you can open by either navigating to it via File > Open Scene or the Project window.

Setting Up Muscle Visualization

Kinesis comes with a Muscle Render Gizmo component that adds muscle visualization elements to the Scene view.

  1. Create a new empty GameObject and rename it to “MuscleRenderGizmo” (the name isn’t critical).
  2. Add a Muscle Render Gizmo component to the new object.
  1. Your project hierarchy should now look something like this: Screenshot of Muscle Render Gizmo added to hierarchy

Setting Up a Basic Muscle

For the tutorial, we’re using a slightly modified character model from Unity’s Starter Assets - Third Person Character Controller, but the following steps should work for pretty much any other model with a typical humanoid skeleton.

Unpacking the Prefab

In order to freely edit the tutorial model, first we’ll need to unpack the prefab to unlink it.

  1. Find the “TutorialArmature” object in the Hierarchy window and secondary click on it to open up a context menu.
  2. Select the Unpack Prefab option. Screenshot of Hierarchy object context menu

Creating a Jointed Limb

Before you can create a functioning muscle, you’ll first need at least two Rigidbody objects connected by a Joint. We’ll set up the left arm’s upper and lower sections with Rigidbody components and connect them via a CharacterJoint component that represents the elbow.

  1. In the Hierarchy window, expand out the object hierarchy under “Skeleton” until both the “Left_UpperArm” and “Left_LowerArm” objects are exposed. The path should be “TutorialArmature” > “Skeleton” > “Hips” > “Spine” > “Chest” > “UpperChest” > “Left_Shoulder” > “Left_UpperArm” > “Left_LowerArm”. Screenshot of unrolled hierarchy
  2. Add a Rigidbody component to the “Left_UpperArm” object.
  1. Configure the Rigidbody component on the “Left_UpperArm” object:
  1. Add both a Rigidbody and Character Joint component to the “Left_LowerArm” object.
  2. Configure the Rigidbody component on the “Left_LowerArm” object:
  1. Configure the Character Joint component on the “Left_LowerArm” object:

Creating a Muscle

  1. Create a new empty GameObject, rename it to “Biceps”, and attach the Muscle Tendon Unit component to it. You can either use the Add Component picker and search for “Muscle Tendon Unit,” or you can drag the script at Kinesis/Scripts/Core/MuscleTendonUnit from the Project window and drop it over the Inspector window.
  2. Once the Muscle Tendon Unit component as been added to your object, you’ll need to define some muscle nodes to define the muscle path. In the Inspector Window, go to the Muscle Nodes field and select the plus icon to add a new muscle node item to the list.

Note: Muscle nodes are expected to be defined in order from origin to insertion.

  1. Configure the first muscle node:
  1. Add a second muscle node.
  2. Configure the second muscle node:
  3. Set the Bone field of the second muscle node to reference the “Left_LowerArm” object.
  4. Set Offset to X:0, Y: 0.04, Z: 0.02.
  5. Your Inspector window should now look something like this: Screenshot of Biceps object focused in Inspector window

Testing Muscle Movement

Once you’ve defined your muscle path, it’s time to test its movement. Kinesis comes with a Muscle Stimulator component for convenience. It allows you to directly run physics simulation and set excitation for individual muscles from the Editor.

  1. Add a Muscle Stimulator component to the “Biceps” muscle object.

Tip: It might help at this point to collapse the Muscle Tendon Unit component in the Inspector window by selecting the triangular icon next to the name in the header bar. This will help declutter your view.

  1. Configure the Muscle Stimulator component:
  1. Enter Play Mode and bring the left arm into view in the Scene view.
  2. With the “Biceps” muscle object in focus in the Inspector window, navigate to the Muscle Stimulator component and change the value of the Excitation field by adjusting the slider. You should see the lower arm react to the changes in excitation. Screenshot of Biceps being activated in Scene view

That’s the end of the tutorial. Feel free to continue to experiment with the tutorial environment or move on to the Demo Scene.