<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by elliott davis on Medium]]></title>
        <description><![CDATA[Stories by elliott davis on Medium]]></description>
        <link>https://medium.com/@moletotem?source=rss-2986c27f2929------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SwWB7eEQ_ZvWz5bPvHPnVQ.jpeg</url>
            <title>Stories by elliott davis on Medium</title>
            <link>https://medium.com/@moletotem?source=rss-2986c27f2929------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 17:29:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@moletotem/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Character Rigging: Faces in Blender]]></title>
            <link>https://moletotem.medium.com/character-rigging-faces-in-blender-e86cf3b5001a?source=rss-2986c27f2929------2</link>
            <guid isPermaLink="false">https://medium.com/p/e86cf3b5001a</guid>
            <category><![CDATA[blender3d]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[elliott davis]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 15:56:53 GMT</pubDate>
            <atom:updated>2021-01-27T15:56:53.598Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial lists some techniques for adding facial animation controls to an existing character model in Blender.</p><p>This tutorial assumes you have a character model, weighted to an armature skeleton.</p><p>This tutorial is written as a high-level list of steps for each technique. For a more detailed explanation, and an in-depth list of steps, please check out this companion, long-form tutorial: <a href="https://moletotem.medium.com/character-rigging-how-to-set-up-face-animation-controls-in-blender-cc240755bece">character-rigging-how-to-set-up-face-animation-controls-in-blender</a></p><p><strong>Eye Movement</strong></p><p>Separate the eyes as their own objects.</p><p>Create bones at the centers of the eyes, pointing forwards.</p><p>Use “Parent &gt; Bone” to attach the eyes to the eye bones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*iERv1RDNItdPWDEw" /><figcaption>eyes looking around</figcaption></figure><p>Create target bones at a distance in front of the eyes (2m).</p><p>Give the target bones a parent centered between them.</p><p>Set the bones to ignore the scale of their parent (to let you scale the parent to focus the gaze at the point of the parent target.</p><p>Use a Track To constraint on each eye, specifying the target bones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*MS_JCFoGStOB5Bmc" /><figcaption>look target bones</figcaption></figure><p><strong>Create the inside of the mouth</strong></p><p>Use Rip to open the edges where the closed lips meet. Leave the edges a small distance apart.</p><p>Extrude the edges inwards in steps and round the shape to create a balloon. Use “Clipping region” (Alt-B) to work inside the head geometry.</p><p>Move the lip edges back together to meet or slightly overlap.</p><p>Optionally create teeth and gums.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*VBvPP0wbHc1L-jb7" /><figcaption>rip mouth edges</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6-WCAy5uCfTxaLxn" /><figcaption>starting a mouth cavity</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5EF4Vk5M7onV2uWt" /><figcaption>finishing a mouth cavity</figcaption></figure><p><strong>Shape Keys</strong></p><p>Shape Keys are mesh deformations driven by a set of alternate vertex positions. Some face animations are suited for using Shape Keys instead of deformation bones. Shape Keys can also easily be controlled with scripting in a game engine like Unity. In Unity, importing a mesh with Shape Keys (and no armature or animation) will result in an asset that is a SkinnedMeshRenderer (instead of a MeshRenderer). The SkinnedMeshRenderer component will also have a dropdown called “BlendShapes” with the Shape Keys listed as sliders. You can use the SetBlendShapeWeight function on a reference to the SkinnedMeshRenderer, with the index of the blend shape, and a weight as parameters.</p><p>Mirror, and Subdivision Surface modifiers need to be applied, or Shape Keys won’t be exported.</p><p>These modifiers can’t be applied if the mesh already has Shape Keys on it; the existing Shape Keys need to be deleted before the modifiers can be applied.</p><p><strong>Blink (Shape Key)</strong></p><p>Add the “Basis” Shape Key, and an additional Shape Key; name it “Blink”.</p><p>Select the “Blink” Shape Key and edit the mesh, scaling the eyelids closed, and tweaking positions sculpturally.</p><p>Use the X-Axis Mirror setting to edit symmetrically.</p><p>Leave edit mode and scrub the Blink Shape Key’s value to test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*_rSJ0nkdqH-hapmz" /><figcaption>blink Shape Key</figcaption></figure><p><strong>Mouth open (Shape Key)</strong></p><p>Add a Shape Key and name it “MouthOpen”.</p><p>Select the “MouthOpen” Shape Key and enter edit mode.</p><p>Select the vertices along the jawline, place the cursor at the rotation point of the jaw, and use Proportional Editing with the “Connected” setting on to deform the chin as if the mouth were open.</p><p>Use Proportional Editing with the “Connected” setting on to adjust the lips to match.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*R_p-fhWoQI6nwa6w" /><figcaption>proportional editing the jaw</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*8ky7Ks1Rq8Hv9qp3" /><figcaption>previewing the mouth open Shape Key</figcaption></figure><p><strong>Animating Shape Keys</strong></p><p>Right-click on the Shape Key value and select “Insert Keyframe” to create a keyframe for the Shape Key at the current frame.</p><p>Switch to the Animation workspace and switch the Dope Sheet’s mode to “Shape Key Editor” to create and select from multiple Shape Key animations for your mesh object.</p><p>Open the Nonlinear Animation editor and use the “Push Down” operation there, or in the Shape Key Editor and Action Editor to add NLA Strips to the Nonlinear Animation timeline.</p><p>Arrange multiple animations into one timeline. An animation will be exported for each Action in an NLA track. Shape Key data within the beginning and end of each Action in the timeline will be included in that exported animation. The exported animations will be named with the names of the NLA Strips.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wOHv76m9KtXSItBA" /><figcaption>Nonlinear Animation editor with tracks for actions and shape key actions</figcaption></figure><p><strong>Eyelid Deformation Bones</strong></p><p>Create bones along the surface of the eyelids to be control bones.</p><p>Create bones connecting the bases of the control bones.</p><p>Clear the “Connected” value for all these bones and set their parent to the head bone.</p><p>Use a Copy Position constraint targeting the control bone at the base, and a Track To constraint targeting the control bone at the tail for each connecting bone.</p><p>Paint in the weights for each connecting bone, and erase the weights from the head bone for the eyelid regions.</p><p>Use the same technique for the eyebrows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*XsSk9tLg2UbPNQsz" /><figcaption>pulling weighted eyelid control bones</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*ycb_JxB4U0duKJoq" /><figcaption>weight display, selecting the head and each eyelid bone</figcaption></figure><p><strong>Mouth Deformation Bones</strong></p><p>Create a jaw bone from a centered position in front of and at the bottom of the ears.</p><p>Paint in the weights of the jaw, and erase the weights from the head bone. Ensure the top lip is excluded by the jaw bone and the bottom lip is excluded by the head bone.</p><p>Attach bottom teeth and gums to the jaw using “Parent &gt; Bone” if they exist.</p><p>Create control bones and connecting bones along the top and bottom lips using the same technique as the eyelid deformation bones section above.</p><p>Paint in the weights for each connecting bone, and erase the weights from the head and jaw bones for the upper and lower lip regions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zpKsiIPhpp0SEqNM" /><figcaption>jaw bone with weights</figcaption></figure><p>This face rig is suitable for posing the face in expressions, and creating mouth movements for a talking character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*96lY9r-zem8gZvdoxKwwxA.gif" /><figcaption>lip sync animation</figcaption></figure><p>For additional control, you might also want to add deformation bones along the cheek or in the nose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KEGIPb96qkm1nRcP" /><figcaption>cheek control bones</figcaption></figure><p><strong>Tips for weight painting</strong></p><p>Set the “Zero Weights” visualization to “Active” to easily spot near-zero values that would cause visible deformation in unintentional places.</p><p>Enable the new “Weight Contours” visualization to add lines to the weight color gradient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e86cf3b5001a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Character Rigging: How to Set up Face Animation Controls in Blender]]></title>
            <link>https://moletotem.medium.com/character-rigging-how-to-set-up-face-animation-controls-in-blender-cc240755bece?source=rss-2986c27f2929------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc240755bece</guid>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <category><![CDATA[blender3d]]></category>
            <dc:creator><![CDATA[elliott davis]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 15:54:23 GMT</pubDate>
            <atom:updated>2021-01-27T15:58:16.696Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial describes some techniques for adding facial animation controls to an existing character model in Blender.</p><p>This tutorial assumes you have a character model, and have created an armature skeleton for it.</p><p>I’m going to present some techniques for adding several things to your animated character:</p><ul><li>eye movement</li><li>blinking (either with Shape Keys, or with deformation bones)</li><li>a mouth that opens</li><li>eyebrow expression</li><li>posable lips</li></ul><p>This is an in-depth, step-by-step tutorial, with explanations, and navigation-centered descriptions. For a more high-level summary of the techniques presented in this tutorial, please check out the companion document here: <a href="https://moletotem.medium.com/character-rigging-faces-in-blender-e86cf3b5001a">character-rigging-faces-in-blender</a></p><p>This is a tutorial for Blender 2.9, but most of the steps of the tutorial will still apply for older versions. The UI for Blender 2.79 and below will look different from the screenshots I provide. I will note when a feature is new, and not available in Blender 2.79 or older.</p><p>I resisted switching from Blender 2.79 for a while, because I experienced low frame rates in the viewport, while the older version of Blender ran smoothly. I use an older Mac laptop with a retina display for game development. I eventually resolved this performance problem by enabling “Open in Low Resolution” for the Blender app.</p><p>Blender can be downloaded here:<a href="http://download.blender.org/release/Blender2.79/"> https://www.blender.org/download/</a></p><p>This tutorial also assumes the character is going to be used in a game made with Unity. Some of the steps will mention Unity, and the tutorial includes some steps for setup there. Most of the tutorial will still be useful if your destination is another game engine, or a use other than games.</p><p>My last tutorial ended with a capsule character that could be controlled in Unity. This one is starting with the assumption that you have a completed character. Which is a real “Draw the rest of the owl” energy, and I’m sorry. I want to make another tutorial about creating the character model and animation soon.</p><p>The character model this tutorial starts with is representative of the result of my character modelling process, and hopefully has enough similarity to those made in popular processes that the early steps will make sense.</p><p>The model is:</p><ul><li>Fairly low resolution (it’s 6000 faces, but a big difference shouldn’t matter much).</li><li>It has an armature skeleton, with a neck followed by a single head bone.</li><li>The mesh object has been attached to the skeleton and the weights are painted so the deformation is convincing (improved from automatic weights, so that for example, the head is more completely weighted to the head bone and bending happens at the neck; and not much mass is lost at the hips and waist when the legs bend).</li></ul><p>Some more details that shouldn’t impact the steps of the tutorial if your model doesn’t match:</p><ul><li>IK bones and constraints have been added for ease of animation of the arms and legs.</li><li>The hands have finger bones.</li><li>The armature has a root bone at its base.</li><li>The model has been UV unwrapped, and has a painted, diffuse colour texture.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lSLMtJQKEoEZ1urR" /><figcaption>a baby</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OSFF6CWimeZ_B5dL" /><figcaption>a baby with armature bones visible</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X0Wxvc9fGB-82Zgi" /><figcaption>a baby with bone names labeled, and wireframe shown</figcaption></figure><p>There are a couple things I will recommend setting up in Blender quickly before we start.</p><p>The command search function is incredibly useful, and I believe it to be the key feature in the change in Blender’s reputation from cryptic to easy-to-learn. In Blender 2.79, the command search was accessed by pressing the spacebar by default. The default in 2.8 and above maps the command search to the F3 key. This isn’t so much harder to access, but I hope they move it back to spacebar as the default, and I think you should put it there yourself until they do. This can be set under Preferences, in the Keymap section, and then in the Preferences section at the top of that, change “Spacebar Action” to “Search”.</p><p>The 3D Viewport camera has a near clipping plane and a far clipping plane, and those have default values that try to cover general use cases for Blender. I find that the default near clipping plane distance is too far for character modelling (because the character takes up a generally small space, and I often want to work on small details). You can change this property in the right panel of the 3D Viewport (press the N key, or click the tiny arrow on the right side of the view to open the right panel). In the View tab, change “Clip Start” to 0.01.</p><p>I also recommend reducing the viewport camera’s field of view a bit. Working on small details, I find the default perspective feels too exaggerated. Bring the “Focal Length” setting in the same place up to 90. This will have the effect of zooming in the camera a bit.</p><p>If you use a laptop, you might already have the “Emulate Numpad” setting on. This maps the numeric keys across the top of the keyboard to the Blender functions that are intended to be accessed with the numpad keys, such as quickly switching to front, side, and overhead views in the viewport. You can enable that in the Input category of the Preferences window. Using a laptop with Blender 2.8 and newer, I also found I needed to bind alternate shortcuts for the geometry select settings when in mesh edit mode. In Blender 2.79, Ctrl-Tab brought up a selection menu, and I could press 1, 2, or 3 to choose vertex, edge, or face. Ctrl-Tab now opens a mode selection menu. And there didn’t seem to be an alternate shortcut for those using emulate numpad. I bound these to Ctrl-1, Ctrl-2, and Ctrl-3. These functions are listed in the Keymap section of the Preferences window under “mesh.select_mode”, with “Vertex”, “Edge”, or “Face” set as the “Type” option.</p><p>Weight painting is a very visually difficult task for me. One thing that makes it difficult is not being able to easily see the difference between a weight of zero, and a weight of nearly zero. A nearly zero weight can easily be seen in motion when a part of the body is slightly attached to a bone somewhere else on the body. You should definitely enable the “Zero Weights” visualization to make those problems easy to catch. With a model selected in Weight Paint mode, open the Show Overlays dropdown popup menu. And find the Weight Paint section at the bottom. Set “Zero Weights” to “Active” to display geometry that is not weighted to the selected bone as black, instead of blue.</p><p>Another setting in the same place is “Show Weight Contours”, which is new in Blender 2.8. This will be a little more noisy to look at, but it adds stripes to the color gradient of the weight paint display. The stripes make it much easier to see and get a sense for the changes in weight value on the model. This setting can allow you to keep some sort of shading in the display, or show a bit of the texture color without limiting your ability to see the weights you are working on too much.</p><p><strong>Eye Movement</strong></p><p>In this section we will:</p><ol><li>make the character’s eyes separate</li><li>create bones for the eyes</li><li>create bones to be targets for the eyes to look at</li><li>make a parent for the look targets</li></ol><p>Make your character’s eyes spheres that are separate from the rest of the model. The eyes should be separate objects from each other as well. It’s fairly easy to update the other eye using a mirror modifier if you make changes to one. Or you can make a linked duplicate with Alt-D to have them share the same mesh and texture UVs.</p><p>Place bones starting from the centers of the eyes and and with the tail of the bones pointing forward. If you select a sphere and use the command “Snap Cursor to Selected”, you can position the 3D cursor to create the bone in the right place. This command is also in the Snap menu, which you can pop open with Shift-S.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jO9xXYSvhagMeS0A" /><figcaption>Snap menu</figcaption></figure><p>Name the bones symmetrically. You can create one bone and name it something ending with the appropriate “_L” or “_R” and then select it and use the “Symmetrize” command with that bone selected to create the opposite one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rvc4RcQzzL8X0ZRW" /><figcaption>Symmetrize eye bone</figcaption></figure><p>Put the armature in pose mode (in pose mode, selected bones show blue instead of yellow) and select one eye bone. Then select the eye mesh object, and shift select the bone again. Use the “Parent” command, and select “Bone” from the menu options. When we eventually get the asset into Unity, this will result in the eye being attached to this bone as a static mesh instead of a skinned mesh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RxiAamXYuWcMNPTx" /><figcaption>parent eye to eye bone</figcaption></figure><p>Do the same with the other eye bone and the other eye.</p><p>Now if you rotate the eye bones in pose mode, the eyes rotate with them. Set the pivot mode to “Individual Origins”, and you can rotate both eyes together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*MJoTK87wFuFlA69-0jMPGA.png" /><figcaption>pivot modes drop down</figcaption></figure><p>Select both eye bones in pose mode and press R, R to map your planar mouse movement to a track-ball-style rotation of the selected objects. You can reset the rotation again with Alt-R.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*3QbuSGG32ec4PtUr" /><figcaption>eyes looking around</figcaption></figure><p>Let’s set the parent of the eye bones to be the head. Switch back to edit mode with the armature selected. Select the bones and go to the Bone tab in the Properties panel. Select the head bone by name in the list that shows when you click on the field labeled “Parent”. If you hold Alt when you click to select from the list, all selected bones will have their parent set, otherwise, only the parent of the active bone is set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*F-_pd42_iqSV9Cwk" /><figcaption>bone parent list</figcaption></figure><p>Now we are going to make a look target for the eyes.</p><p>First let’s check in the tool panel to see that X-Axis Mirror is on. Press N to toggle the right panel open if it is closed, then select the Tool tab. X-Axis Mirror is under “Options” in that tab, when an armature is selected and in edit mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N47RLro9t3kaTdoT" /><figcaption>x-axis mirror, in options section, in Tool tab, in right panel</figcaption></figure><p>In Blender 2.79 or lower, this option is in the left panel, in the Tools tab (press T to toggle the left panel).</p><p>In Blender 2.8, a second X-Axis Mirror setting was introduced for pose mode, which makes moving and rotating bones in pose mode symmetrical. The new setting is also in the Tool tab, but under “Pose Options”, when an armature is selected in pose mode.</p><p>Select one of the eye bones in edit mode and press Shift-D to duplicate, then press Y to lock to the Y-axis, and then press 2 to specify 2 units along this axis. If this puts the new bones behind your character, press — (minus sign) to toggle the direction on that axis. Press Enter, or Left-click to complete the duplicate action.</p><p>If the X-Axis Mirror setting is on, and your eyes were named symmetrically (having the same name but with corresponding “_L” and “_R” at the end), this duplicate action will have created two bones.</p><p>Let’s rename the new bones to something like “EyeTarget_L” (and “EyeTarget_R”).</p><p>Now we’ll make a constraint for the eye bones to point to the target bones.</p><p>In Pose mode, select one of the look target bones, and then the corresponding eye bone. Press Ctrl-Shift-C to pop up the Add Constraint (With Targets) selection. Choose “Track To” from the bottom of the middle list. This adds a bone constraint to the active bone (the one selected last) and tries to supply other selected bones as the targets. The Eye bone should be green now instead of the default grey.</p><p>Bones have their own orientation. The pointy end of the bone is called the tail, and it points along the bone’s Y axis. If your eye suddenly “looked up” when you attached the constraint, we need to specify that it should track the Y axis in the Track To constraint (and also set Up to Z). You can view the bone constraints for a bone in the properties panel. This category only shows up when bones are selected in Pose mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/0*Z_3-PXJ5EZ794Zg1" /><figcaption>bone constraints icon in properties panel tabs</figcaption></figure><p>The “Add Bone Constraint” button at the top of this panel brings up a similar selection screen as using Ctrl-Shift-C, but selecting a target requires you to pick an object instead of a bone, and then in the case that the object is an Armature, you can then select the bone. Using Ctrl-Shift-C saves two steps in this case.</p><p>Adding a bone constraint is not applied symmetrically the way that editing the bone is. Select the other eye target bone, and eye bone, and then press Ctrl-Shift-C and choose “Track to”.</p><p>Switch back to Edit mode and select just the start (or Head) of both eye target bones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lR9ld-ksBNuoHIjF" /><figcaption>heads of the eye tracking bones selected</figcaption></figure><p>Press Shift-S to open the Snap menu, and choose “Cursor to Selected”. This places the cursor midway between the starting points of the two bones. Now select both bones (the middle, connecting sections), and change the Pivot Point setting to 3D Cursor. In Blender 2.8 and above, the period key opens the Pivot Point menu, similar to the Snap Menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i3UJn7_FNWjrqWpa" /><figcaption>pivot point setting</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*49c3VOigIyKyw0Ua" /><figcaption>pivot point menu</figcaption></figure><p>Rotate the look target bones 90 degrees, so they are pointing up instead of forwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*9Ip46ptzypbQ-K4K" /><figcaption>eye target bones pointing up</figcaption></figure><p>Now add a new bone (still using this cursor position). Name it something like “Look_Target”. You can select the tips of the two eye target bones, and use “Snap Cursor to Selected” again, and then select the tip of the new “Look_Target” bone, and use “Snap Selected to Cursor” to position the tip so that all three bones are the same length and in a row. Set this new bone as the parent for each of the eye targets, so you can move them together. Also set Inherit Scale to “None” for each eye target. In Blender 2.79, Inherit scale is a checkbox; disable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*rR5YTZpcu0U-jzfq" /><figcaption>set parent, disable inherit scale</figcaption></figure><p>Set the parent for the look target bone to be nothing, or if your character has a root bone at its base, set it to that. Uncheck the Deform option on all three of these bones and the eye bones. With this off, the bones will be excluded from contributing to bone weights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*xgyGhvAbfb1Bg4-k" /><figcaption>deform option</figcaption></figure><p>Now the position of the look target controls the eye rotation. You can also scale the look target to bring the eyes to focus at the center (this is important for looking at something close to their face, but not important if you just want to control the direction the character is looking). You can keyframe the position and scale of this bone like the rest of the armature to include eye movement in the character’s animations.</p><p>Another option is to control the look target in Unity with a script. Bone constraints will not be part of an exported model; the following script would reproduce the effect of the Track To constraints on the eyes.</p><pre>using System.Collections.Generic;<br>using UnityEngine;</pre><pre>public class LookTargets : MonoBehaviour<br>{<br>    public Transform Eye_L;<br>    public Transform Eye_R;<br>    public Transform EyeTarget_L;<br>    public Transform EyeTarget_R;<br>    Quaternion originalRotation_L;<br>    Quaternion originalRotation_R;</pre><pre>    void Start()<br>    {<br>        originalRotation_L = Eye_L.localRotation;<br>        originalRotation_R = Eye_R.localRotation;<br>    }</pre><pre>    void Update()<br>    {<br>        Eye_L.rotation = Quaternion.LookRotation(EyeTarget_L.transform.position — Eye_L.transform.position, Vector3.down) * Quaternion.Euler(90, 0, 0);<br>        Eye_R.rotation = Quaternion.LookRotation(EyeTarget_R.transform.position — Eye_R.transform.position, Vector3.down) * Quaternion.Euler(90, 0, 0);<br>    }</pre><pre>    public void StopTracking()<br>    {<br>        Eye_L.localRotation = originalRotation_L;<br>        Eye_L.localRotation = originalRotation_R;<br>        enabled = false;<br>    }</pre><pre>    public void StartTracking()<br>    {<br>        enabled = true;<br>    }<br>}</pre><p>To use a combination of animation and scripting, you might need to create one or more masks for the asset in Unity.</p><p>Let’s move on to blinking next.</p><p><strong>Bones vs Shape Keys</strong></p><p>There are two ways we could approach facial animation: Using more deform bones, or using Shape Keys (or blend shapes as they are called in Unity). Both of these techniques have some drawbacks that make them awkward to use, and the choice of which technique to use really depends on evaluating holistic factors. What I mean by holistic factors are things like “if I am working in a team, should I make the exported model have as few special steps as possible”; or “does this model use modifiers”, and “would I need to do extra maintenance work if I need to change something later”. Ultimately, Shape Keys are more complicated to set up with respect to exporting animation than additional deform bones, and additional deform bones are more complicated to set up before being able to produce animations with them.</p><p>I think it makes sense to show both methods even though that makes this tutorial more complicated.</p><p>Shape Keys are mesh data that define alternate positions for vertices in the mesh. They give you control to blend to the alternate positions with a factor. At a factor of 1, the vertices use the alternate positions; at factor 0, they use the original positions. At a factor value between 0 and 1, the vertex positions will be morphed partway between the two. The morph is linear: each vertex will take a straight line between the positions, which can give quite a different result from using deformation bones. The linear interpolation is also the reason Shape Keys are not used for animating the limbs of a character. Shape Keys can still work well for blinking, and mouth movement, and it gives a great deal of sculptural control to the character artist.</p><p>The peril in using Shape Key animation is that there are a lot of situations where things seem like they will work, but don’t and there’s no indication why (particularly when importing animation).</p><p>If your character uses a mirror modifier, you can make and use Shape Keys in Blender, but they will not be included in the exported model. The mirror modifier needs to be applied. Also, you cannot apply the mirror modifier if the model has any Shape Keys (so you need to delete the Shape Keys, apply the modifier, then make the Shape Keys again). The same is true for a subdivision surface modifier. There are some techniques to transfer data from a copy of the model to avoid losing too much work if you find yourself in this situation, but it could be that the deform bone technique further below is better suited to your situation if you want to preserve symmetry or subdivision on the character.</p><p>Shape Key animation is keyframed on the mesh object, and not the armature. When you create animations for a character using an armature, you create a type of animation in Blender called Actions. Actions are exported by default, and become available as animation clips on the imported asset in Unity. Shape Key animation is not included by default, and needs to be explicitly moved into a separate animation system in Blender called NLA or NonLinear Animation. Explicitly moving the animations also allows you to combine different kinds of animations (Actions and Shape Key animations, as well as others), which can be useful. Once you set the animations up in this way in Blender, they will export together and not introduce any extra complexity for the imported model in Unity.</p><p><strong>Adding Shape Keys</strong></p><p>With the mesh object selected, you can navigate to the Object Data tab in properties. The Vertex Groups section lists the names of the bones, which represent collections of vertex numbers (the indices of the vertices in the mesh), and their weightings to the bone with that name.</p><p>Under Vertex Groups, Shape Keys is the next section. To add a new Shape Key, press the plus button to the right of that empty list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*w9O6SVosufPQg-vs" /><figcaption>add shape key button</figcaption></figure><p>The first Shape Key will appear with the name “Basis”. You should leave this Shape Key and add a second one. The second Shape Key will appear with the name “Key 1”. Let’s rename that to “Blink”. Selecting a Shape Key in this list, will modify that Shape Key when you make changes to vertices in edit mode.</p><p>The Basis Shape Key is essentially the original mesh positions. Other Shape Keys have a weighting value next to them in this list, which is the place you control the factor to apply the shape key, described above. The Basis Shape Key does not have a value, and is essentially always 1. A Basis Shape Key is mandatory, and it’s confusing that you need to add it yourself in order to add another, first Shape Key.</p><p>If you want to edit the mesh (and not create deformation as a Shape Key), select the Basis Shape Key. This is important to remember the way that selecting the correct layer in a paint program is important.</p><p>Select the new “Blink” Shape Key and enter edit mode. Make a simple change to the model; select the edges of the top and bottom eyelid and scale them to 0 on the Z axis (with the pivot point setting set to “Bounding Box Center”), as an example.</p><p>Exit edit mode, and notice that the deformation is no longer visible. Toggle back into edit mode again, if you want to confirm it wasn’t actually undone. In Object Mode, drag the value next to “Blink” in the Shape Keys list to 1. The Shape Keys are applied and combined based on their values. In edit mode, you will see only the selected Shape Key, applied at a value of 1, over the Basis Shape Key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*awFW4WaTFI6v2uva" /><figcaption>scrubbed blink</figcaption></figure><p>You can select the “Blink” Shape Key and use the edit mode tools to move vertices around and create a more natural looking closed eyelid pose for it.</p><p>You can also use Blender’s sculpting tools to edit Shape Keys. In sculpt mode, the sculpting brushes will affect the selected Shape Key, but the appearance of the model will respect all the Shape Key values. Unlike when using edit mode, you should set the selected Shape Key to value 1, and all others to zero to edit that Shape Key in sculpt mode.</p><p>If you add or remove vertices, or edges or faces, those changes are made to the mesh data (essentially to the Basis Shape Key as well).</p><p>Modifying the Basis can affect Shape Keys you have already made. Blender is pretty good at keeping track of what is affected, but it is complicated. For Shape Keys, if we aren’t modifying the geometry that is moved in existing shape keys, we are free to modify (even delete and create new geometry) without changing those Shape Keys. If you change the geometry that an existing Shape Key deform, you can expect strange looking changes. You will likely need to clean up, or re-make Shape Keys if you change the geometry under them. This is true of the way Blender handles vertex colours, and UV maps for textures as well; Blender has a way to guess at appropriate values when you extrude an edge, say, but it’s not assured to be appropriate for your needs (since there are many uses for the same operation).</p><p>You can check if Shape Keys are being included by exporting just the mesh. Without the armature, there should be no bones, and no animation, and normally, that would mean the imported object has a MeshRenderer instead of a SkinnedMeshRenderer. If the Shape Keys are included, the object will be a SkinnedMeshRenderer (without the armature, or animations). The SkinnedMeshRenderer will also have a dropdown called “BlendShapes” with the Shape Keys listed there as sliders.</p><p>You can control Shape Keys procedurally in Unity. Similarly to eye movement looking at targets above, blinking could be driven by a scripted system instead of by the animation playing on the character. If you want to control blinking procedurally, you may not need to worry about the extra trouble of including Shape Keys in animations.</p><p>To control these slider values procedurally from a C# script, use a reference to the SkinnedMeshRenderer, and set the weight of the blend shape by index (0 if you only have one Shape Key).</p><pre>public SkinnedMeshRenderer skinnedMeshRenderer;<br>public int blinkShapeKeyIndex;</pre><pre>// the blink value is how closed the eyes are from 0 to 1<br>public void SetBlinkValue(float blinkValue)<br>{<br>    if (skinnedMeshRenderer.sharedMesh.blendShapeCount == 0)<br>    {<br>        Debug.LogError(“mesh has no blend shapes”);<br>        return;<br>    }</pre><pre>    skinnedMeshRenderer.SetBlendShapeWeight(blinkShapeKeyIndex, blinkValue);<br>}</pre><p>If you want to match the Shape Key by name, you should capture the correct index with a method like this:</p><pre>void Start()<br>{<br>    Mesh mesh = skinnedMeshRenderer.sharedMesh;<br>    if (mesh.blendShapeCount == 0)<br>    {<br>        Debug.Log(“mesh has no blend shapes”);<br>    }<br>    else<br>    {<br>        for (int i = 0; i &lt; mesh.blendShapeCount; i++)<br>        {<br>            if (mesh.GetBlendShapeName(i) == “Blink”)<br>            {<br>                blinkShapeKeyIndex = i;<br>            }<br>        }<br>    }<br>}</pre><p><strong>Create the inside of the mouth</strong></p><p>This Shape Key deformation method can be used to control opening the mouth as well.</p><p>Before I cover animating Shape Keys, let’s create another Shape Key for opening the mouth. But first, the character mesh needs to have mouth geometry to open. If the character model you are using has a mouth that can’t open, and the lips are modelled closed, we can modify the mesh to open the mouth and create an interior (The part that shows when the mouth is open). It can be easier to make the inside of the mouth when the model is using a Mirror modifier for symmetry, but can still be done when it is not.</p><p>Disable the Mirror modifier while working on the interior to be able to see inside the model through the open half. Use the “Clipping Region” command (Alt-B) to isolate what is visible. Dragging a box with this tool culls the rendering of anything outside the frustum created by the projection of that box to the position of the view camera. After enabling a clipping region, you can rotate the view to look in the sides of that 3D slice of your model. Clipping Region may not render correctly for some viewport shading options, and you might need to set the viewport shading to “Solid” to use it. Press Alt-B again to toggle the clipping region off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ujoyf6fsCYC57CCN" /><figcaption>clipping region</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NrtEDMPWST9-kbVM" /><figcaption>clipping region inside view</figcaption></figure><p>Select the edges along the line of the mouth and run “Rip Vertices”. This will split each vertex along the edges into two, and each edge into two, essentially cutting the surface of the mesh along that line. The original vertices or edges will remain selected, and the new ones will not be selected; this results in the edges of either the top or bottom lip being selected in isolation. Move the selected edges up or down, to open the mouth a small amount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*QSLGVHLLPxZFU_oh" /><figcaption>opened edge on mouth line</figcaption></figure><p>Select all the edges along the mouth opening and extrude them in, to begin creating the mouth cavity. Leave an edge loop close to the original lip edges, and extrude again. Make the second set more circular and repeat that to trace out a spherical shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gxta3OVEx0ZmKBu3" /><figcaption>inside of the mouth, half done</figcaption></figure><p>Close off the inside after a few more extrude steps by pressing F with the open edges selected to create a face closing it, then use “Poke Faces” to divide that face into triangles with a point at the center.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GejBZcNLRjBj3AZl" /><figcaption>inside of mouth finished</figcaption></figure><p>If you like, you can reduce the detail on this shape by merging vertices in the extruded segments. Because the edges we started from at the lips already had bone weights, all the points we created by extruding will have the same weights, and should be already weighted to the head bone. The same is true for the UV coordinates, but the result of having the same value is that the colour at the edge of the lips will be stretched across the inside of the mouth. You may want to update the UVs by unwrapping the inside of the mouth. Try selecting the edges where we started at the lips and running “Mark Seam”, and then selecting the inside with the L key to Select Linked (you might need to select the “Seam” setting in the redo action panel when it pops up). Now you can unwrap that selection. The inside of the mouth is not very important for texture detail, so it can be fit in between other texture islands.</p><p>Finally, you may want to bring the edges of the lips together again, or overlap them slightly to restore the representation of the lips being closed.</p><p>Now check that the blink Shape Key is still working properly. If it is, let’s add another Shape Key and name it “MouthOpen”. Select that Shape Key and go into edit mode. Place the 3D cursor where the hinge of the jaw would be, just in front of the ear on one side. We can rotate around this point to help create the Shape Key. In Blender 2.8 and later, the shortcut Shift-Right click will place the cursor on the surface under your mouse.</p><p>If you had to apply the Mirror modifier and are missing the benefits of symmetrical modelling, you can turn on the X Mirror setting for mesh editing. This is in the Options section under the Tool tab in the right panel. (in Blender 2.79 and earlier, this setting was in the left panel under the Options tab).</p><p>Enable Proportional Editing and turn on the “Connected Only” setting. Proportional Editing can be toggled on and off with the O key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*9xi4tXNz_3efcmWr" /><figcaption>proportional editing</figcaption></figure><p>Select vertices along the jawline and rotate around the X axis. Before completing the rotation, scroll the mouse wheel up or down to change the Proportional Editing radius to bring connected points of the surrounding geometry with the selected points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*BGkRCk-121s3GgLw" /><figcaption>proportional rotate</figcaption></figure><p>Now select parts of the lower lip, and using smaller radii with Proportional Editing, make adjustments to sculpt the open mouth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R3klPSvN3QoBqZyt" /><figcaption>open mouth</figcaption></figure><p>Exit edit mode, and scrub the value for the MouthOpen Shape Key so see if it looks natural.</p><p>Don’t forget to turn off Proportional Editing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*J8m0i2R-t1ARDaZa" /><figcaption>mouth open</figcaption></figure><p><strong>Animating Shape Keys</strong></p><p>If you want to include Shape Key deformation in the character animations, you can animate the values by adding keyframes. You can create a keyframe on a Shape Key by right-clicking on the value next to its name in the Shape Keys section in the Properties View (in the Object Data tab, with the mesh object selected) and selecting “Insert Keyframe”. The value background will turn yellow to show this value is keyed on this frame. This keyframe is created at the current time in the timeline, so be aware of the playhead position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*R6lsHtkBpjsBXL_C" /><figcaption>insert keyframe popup</figcaption></figure><p>Once a key has been set, the value background will show green at any position that doesn’t have a keyframe. This colour-coding helps you to know which values are animated, and to avoid creating extra keyframes.</p><p>Create a keyframe on the blink Shape Key at the start of the timeline (frame 0), and with value 0. Then move to the last frame before the character should blink, and set another keyframe at value 0. now move to the next frame (or you can leave a few frames if you’d like the blink to happen a bit slowly), and set another keyframe, at value 1. Now advance one or more frames and set another keyframe at value 0. Now play the animation to see how that looks. You can adjust the position of the keyframes in the timeline to change the timing of the animation, and drag the playhead at the top of the timeline to scrub through the animation at arbitrary speeds.</p><p>If you export the model now, the Shape Key animation won’t be included, and won’t show up in Unity. In order to include it, we need to know about some different animation systems in Blender.</p><p>If you switch to the Animation workspace, the two windows on the left will be the Dope Sheet, and the Graph Editor by default. The Dope Sheet window displays a timeline with the keyframes of animated objects in the scene.</p><p>The Dope Sheet window has a dropdown next to the editor type button in the bottom left. By default, that will be set to Dope Sheet, but it can also be set to “Action Editor”, and “Shape Key Editor” (as well as some other modes). If you have been making character animations already, you may have set it to Action Editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*HUs81pOMVo-5GL7l" /><figcaption>dope sheet mode dropdown</figcaption></figure><p>When the Dope Sheet editor is set to Dope Sheet (its default mode), the armature pose animation shows here as well as the Shape Key animation. If your character has armature animation, the armature object will be visible here as a section, with the animated bones listed as rows (with the keys in the rows). If you created a Shape Key animation by setting a keyframe on a Shape Key, the mesh object will also show up as a section here.</p><p>If you switch from the Dope Sheet view to the Action Editor, a similar view of keys is shown, but the Action Editor shows animation data for only the active object, where the Dope Sheet view shows animation data for all animated objects in the scene. The Action Editor has a dropdown that lets you choose from a set of animations (or select the Linked Action for this object). This interface is very useful to create multiple animations for a character.</p><p>If you switch back to the Dope Sheet view, you may see that there is no way to select actions, and that the keys that are shown for the selected object are those of the action that was selected in the Action Editor view. Though a mesh object can have an action selected, the Shape Key animation cannot be selected in the Action Editor.</p><p>If you switch the Dope Sheet view’s mode to “Shape Key Editor”, you can select Shape Key animations for objects. The Shape Key Editor is almost identical to the Action Editor. With the mesh object selected, and this view open, we can select Shape Key animations and create new ones.</p><p>The Action Editor and the Shape Key Editor allow you to set the Linked Action for objects, which you can think of as setting their current animation. The Dope Sheet shows the keys of the currently linked actions on all the objects in the scene.</p><p>The export settings (for the FBX format) includes a checkbox for “All Actions”, but not one for Shape Key actions, so there isn’t a convenient way to include them, even as separate animations. There is another setting though, for something called “NLA Strips”. NLA stands for “NonLinear Animation”. The NLA system provides a way to have an animation that includes switching the linked actions on objects, which allows you to create and play an animation where an object plays the keyframes of multiple actions. This can be useful in a situation where you might want to make a short animation and have it loop over a long time without needing to copy the keyframes, or needing to copy them again later if you wanted to change the motion a little.</p><p>The Dope Sheet does not have a view for NLA Strips, but instead there is a separate editor window for Nonlinear Animation. I find it convenient to change the Graph Editor to the Nonlinear Animation window in the animation workspace layout.</p><p>If you have the armature selected in pose mode, and the Action Editor open next to the Nonlinear Animation window, you may notice that the name of the selected Action is shown in an orange row in the Nonlinear Animation window. This orange row shows the currently linked action.</p><p>You can think of the Nonlinear Animation window as the real, or superseding animation system. Arranging strips in the Nonlinear Animation window determines what the state of the objects in the scene will be when you move the playhead along the timeline. Creating an animation sets the linked action on an object, which causes it to show up in the Nonlinear Animation window (as well as in the Dope Sheet, and in the Action Editor), but when you create an NLA Strip, you can place actions there, and unlink the actions from the objects; and the contents of the NLA Strips are what plays even when the Dope Sheet and Action Editors have no keys in them.</p><p>In order to create an NLA Strip, we can “Push Down” this action either in the Action Editor, or using a button on that orange row in the Nonlinear Animation window. Pushing an action down creates an NLA Track, with that action in it, and clears the current linked action of the object.</p><p>If you export now, the imported asset in Unity will include an additional animation (you might need to reimport the asset in Unity sometimes for animations to update, or sometimes just select another object to get the inspector to refresh). The name of that animation will be, not the name of the NLA Track, but the name of the strip in that track. The strip will have the name of the action you pushed down, but the name of the strip won’t update if you rename that action. You cannot rename these strips. You can, however, delete the NLA Track, select the action in the Action Editor again, and push it down again to get the updated name.</p><p>Once the action is in an NLA Strip, you can move it left and right in the NLA Track, but also move it up and down to different rows, which are different NLA Tracks. The timeline in the Nonlinear Animation window is separated vertically, grouping NLA Tracks by the objects those animations will play on. An NLA Strip that is an armature action can’t be dragged into an NLA Track for Shape Keys.</p><p>If you push down a Shape Key action and export, the asset in Unity will not include an animation for the Shape Key NLA Strip. But you might find that the Shape Key animation is now part of the NLA Strip you made from an armature action. Shape Key animation is being included in exported NLA Strips, and the position of the strips in the Nonlinear Animation window is determining the timing.</p><p>Essentially, you should only need one NLA Track for the armature, with strips for actions that need to include Shape Key animation, set up in sequence, and one NLA Track for the mesh object, with strips for the Shape Key actions lined up to match the action strips of the armature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gz2hn-7JDNf3TdxK" /><figcaption>NLA Tracks for actions and shape keys</figcaption></figure><p>Each Armature action NLA Strip will be exported as an animation, and will include the shape keys (and other animation data) that overlaps with that strip in the timeline.</p><p><strong>Limitations for Shape Keys</strong></p><p>As I said before, Shape Keys give you a great deal of direct artistic control; posing the eyelids or mouth uses Blender’s modelling tools, and you just put the geometry in a different position directly, without having to set up more bones, or manage bone weights on the mesh. However, you may have encountered or imagined some limitations already. You might have found that after posing the eyelids closed for the blink, though they looked correct open and closed, the eyeball clipped through the eyelid when the value was half-way (and then corrected it by pushing the eyelids out a bit when closed). This happens because Shape Keys are interpolated linearly; each vertex takes a straight line to its destination. When you blink, your eyelids curve around the shape of the eyes, and a linear interpolation on positions can’t create a curve. You could add a second Shape Key, and get a better approximation in sequence; or by controlling the values for two Shape Keys, have a bulge happen in the middle and fade off at the end; but that is a lot to manage. If you want to match a rotation, Shape Keys are more work than deformation bones.</p><p>How about the mouth? We created an open pose and can toggle open and closed, which might be just what you need to make it easy to tell which character is talking in a game. But you might have wanted to add some expressions after seeing how the character still looked emotionless, or fixed in one emotion. Or maybe you just want to better match the words the character is saying. If that’s the case, you can add Shape Keys for a smile, and a frown (and it’s easy to include the eyebrows in those without extra work), and there is a minimal set of mouth shapes to support for animation that you can look up, which can be made as shape keys as well. The mouth shapes match the sounds we make when we speak, which are called phonemes. But you might find yourself wishing you had an easier way to pose the lips, even while producing the phonemes set.</p><p>The alternative is to handle face animation with deformation bones, as part of the armature. A nice benefit to that is that you don’t need to use the NLA window to manage and combine different animation types (unless you still want to use Shape Keys for part of the animation). And the difficulty is that it’s awkward to set up and manage; for creating the bones, for seeing what you are doing, and for managing the keyframes for additional bones in the skeleton and reusing poses.</p><p><strong>Blinking (with deformation bones)</strong></p><p>To make the character blink without Shape Keys, we can create a set of bones along the eyelids. If you want to use the Shape Key blink from the steps above, you can still use this technique to make eyebrows.</p><p>The deform bones along the eyelids are going to stretch between another set of bones which will be the control points.</p><p>To set up the eyelids and make the character blink, we will:</p><ol><li>create the control bones</li><li>create bones connecting the control bones</li><li>set up constraints to make those bones stretch when the control bones move</li><li>set the envelope radius on the deform bones, and add them with envelope weights</li></ol><p>Editing the armature after a mesh is attached with weights, or after setting animation keys, can cause problems. The normal workflow for character models is to create the mesh; create the armature; attach the mesh (creating the bone weights); adjust the weights (weight painting); then begin animating. It’s good to not do too much work on a step until the step before feels finalized, but these steps are interdependent, and it’s important to be able to experiment and to make changes while testing the effects.</p><p>We are going to add some new bones to be control points along the top and bottom eyelid, and then connect those bones with another set that will be the deformation bones.</p><p>Before we do that, let’s move the neck and head bones to a different layer, so we can hide them when they would obstruct our view. Select the armature in edit mode, and select the head and neck bones. Run “Change Bone Layers”, or press M to pop up a window with two sets of sixteen boxes. You can use these thirty-two slots for your own organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lNzJxMoQ_T7fEPnk" /><figcaption>bone layer popup</figcaption></figure><p>Right now, all the bones in this armature are in the first bone layer. The selected bones are in the first layer, so the first box is coloured blue in this pop-up. Click on the second box to move the selected bones to the second bone layer. The head and neck bones will disappear; this is because the armature is set to show only the first bone layer. You can toggle visible bone layers in the Armature tab of the properties panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/0*HmAju1LyTpp3GUWN" /><figcaption>armature properties bone layers</figcaption></figure><p>You can hold shift to select multiple layers. Bones can also be placed in multiple layers by holding shift when clicking on the Bone Layer pop-up. Hide the new bone layer to hide the head and neck bones.</p><p>Now let’s enable Snapping, and set the Snapping mode to Face, this means that while we move a bone in the viewport, it’s position will snap to the surface of our model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*EKDjpOPBd7IFTM7R" /><figcaption>snap mode face</figcaption></figure><p>To add the first bone, use Shift-Right-Click to position the 3D cursor at the inside corner of the character’s left eye.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8osn7wwtouV0YaRN" /><figcaption>cursor at left eye corner</figcaption></figure><p>Now with the armature selected, and in edit mode, add a new bone. This will create a bone starting at the cursor position, but pointing up, and one unit long. We won’t be able to see any of the face if the bones are this size, so let’s adjust that. In the right panel, in the View tab, and under the 3D Cursor section, the X, Y, and Z components of the cursor’s location are listed. These values are the location where we just placed the cursor, which is the starting position of the bone we just made. If you click into the Y field you can enter an arithmetic expression here. Place the text caret at the end of the current value, and add “- 0.02” and press enter. This will evaluate to the previous Y value minus 0.02. The cursor should move forward 2cm. Now select the tip of the bone we made and use the command search to run “Snap Selection To Cursor”, or open the snap menu by Shift-S and select it. Now we have a small bone pointing forward at the corner of the character’s eye. Name this bone “UpperEyelidControl_L”, or something similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NFJq93p9zdaApb8v" /><figcaption>first eye control bone</figcaption></figure><p>Select the bone and press Shift-D to create and drag a duplicate. While you drag this bone, it continues to follow the surface of the model when the Snap mode is set to Face. Place five control bones in an arc across the top eyelid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SPbbWFgu--zqaaWR" /><figcaption>5 control bones</figcaption></figure><p>Now we are going to create bones connecting between these. Select the base of the first bone you created (so that just the ball at the wide end is highlighted), then select the base of the next control bone along the eyelid and press F to create a bone connecting those points.</p><p>When you add a new bone, Blender selects the tip of that bone. Leaving the tip of the new bone selected, shift-select the base of the next control bone, and press F again to create the next one. Now select the base of the next control bone and press F, and create one more with the last control bone.</p><p>Rename each bone in this new sequence to have names like “UpperEyelid0_L”, and numbered in sequence. Turn off Snapping mode when you are done positioning the bones on the surface of the model.</p><p>Creating the bones in this way causes each bone to have its parent set to the previous bone (and the first bone has its parent set to the first control bone we used). We want to change the parent of all of these bones (including the control bones we created first) to be the head bone. Blender supports editing properties of multiple selected objects to a degree. Only the properties of the active object are shown, but for some properties, you can hold the Alt key when making a change and have that value apply to all selected objects. We could select all of the bones and hold Alt while we select the head bone from the parent drop-down list, but that will cause some strange results on some of the bones. The “Connected” setting needs to be disabled first. “Connected” should only be on for the last three connecting bones (the first one was created with the first control bone as a parent; when a bone is connected to the base of another bone, it is not considered connected). Select the last three connecting bones and hold Alt when unchecking the “Connected” setting. Now select the rest of the new bones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jWbQCn80Uwpu6O1l" /><figcaption>selected eyelid bones (just the top ones are made)</figcaption></figure><p>Now go to the Bone Properties and click the Parent field to bring up a choice of other bones in the armature. Select the Head bone, and then hold Alt and press Enter to set that as the parent for all selected bones. Now the upper eyelid bones are all direct children of the Head bone, and not connected to each other.</p><p>Next we’ll set up constraints on the deform bones so they stretch between the control bones when the control bones are moved in pose mode. Switch to Pose mode. Select the first control bone and then the first connecting bone. Press Ctrl-Shift-C to “Add Constraint (With Targets)” for the active bone (the active bone is the last selected bone, showing with a lighter highlight). From the list that appears, choose “Copy Location”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dHnZFoGCL0A6ddk4" /><figcaption>Add Constraint (With Targets)</figcaption></figure><p>Then select the next control bone, and the same connecting bone again (the first bone again, to add a second constraint). Press Ctrl-Shift-C again and choose “Stretch To”. You can try grabbing either of those control bones and moving them to check that it’s working for that first connecting bone. Press Alt-G to reset the position of selected bones.</p><p>Now repeat this process for the other connecting bones: Select the previous control bone, then the connecting bone, and add “Copy Location”. Then select the next control bone and the same connecting bone, and add “Stretch To”.</p><p>Now we are ready to add the vertex weights for these bones.</p><p>You can manually add vertex groups to a mesh with names that match the names of the bones. Or you can highlight each bone while in Weight Painting mode for the mesh and just start painting (the armature needs to be in pose mode; use shift-select to highlight bones). There are also some ways to get usable starting weights for bones, even when attaching them after having finished weight painting for previous bones.</p><p>Bones can be added, contributing automatic weights to the mesh, without destroying the weights of other bones. You can add the weight group for a new bone with the mesh selected and in the weight painting mode. Shift-select the bone you want to add weights for, and then search for the command “Weights &gt; Assign Automatic From Bones”. Automatic weights are a good starting place for most other bones in a character armature, but invoking automatic weights like this is not likely to give us a good result for the deformation bones of the face. We can use another system called Bone Envelopes to get starting weights for these. Using Bone Envelopes can give us a hand setting up the weights for these new bones, and means we don’t need to rely on weight-painting skills as much. If you are comfortable painting bone-weights, you can skip the Bone Envelope section below.</p><p>With the Armature selected, go to the Armature properties tab, and in the section called “Viewport Display”, there is a setting called “Display As”. By default, this is set to “Octahedral”, and shows the bones as you are probably used to seeing them; with a wide end and a pointy end, with balls at the beginning and end, and four sided like pyramids. The other options for this setting can be useful to switch to at times when you’re having trouble seeing the model, the bones, and the weight data all overlapping. If we switch this to “Envelope” though, in addition to the bones looking like tubes now, selected bones will also have a larger transparent outline. This outline is the weight envelope. With the first connecting eyelid bone selected, go to the Bone Properties tab, and under the Deform section, change the Envelope Distance setting. You can also change the Radius Head, and Tail properties, to control the shape of this bone. Envelope weights can be used as an alternative to Blender’s automatic weights when first attaching a mesh to an armature. But you can also invoke the use of that system when adding new weights for a bone.</p><p>We’ll set these values to something very low for the connecting eyelid bones, but we should set low values on the control bones as well, just so they don’t obstruct our view of the connecting bones. Select the control bones and the connecting bones. Set “Radius Head” to 0.001, and hold Alt when you press Enter. Set “Tail” to 0.001 as well, holding Alt when you press Enter. Now set “Envelope Distance” to 0.01, and hold Alt When you press Enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3bwghR5t_2H-u1O3" /><figcaption>Eyelid control bones and connecting bones with .01 envelope distance</figcaption></figure><p>The bones should look like this now, but if they don’t, try not to take it as a personal failing; the multi-select editing in Blender is not very good! Several things could have gone wrong here, and you might need to fall back on editing them one at a time. If you deselect the active object, your selection can contain no active object; and if the properties view shows the active object, what does it show when there is no active object in the selection? It shows whatever was the last selected active object, even though that object is not selected now. If I forget to hold Alt when I enter a new number, only the active object changes that value. If I enter the same value, the value doesn’t change (ok that makes sense); but if I hold alt and enter the same value as the active object, no values will change. If some of the bones have different values, entering a new one that is different from all of them will give that value to the active bone, and give scaled values to the others (which is truly a bizarre behaviour from my perspective).</p><p>Let’s select just the eyelid control bones now, and in the Bone Properties, hold Alt and uncheck the toggle for Deform. These bones won’t have any influence over the mesh, and are just targets for the bones connecting them. With Deform disabled, Envelope Distance, Radius Head, and Tail are disabled in the bone properties tab. We reduced the values first, while the fields were still editable.</p><p>In edit mode, select all the eyelid bones again and search for and run “Symmetrize”. Using Symmetrize won’t create new vertex groups for mirrored bones, so right now, before adding the vertex groups is the right time to mirror the bones.</p><p>Select the mesh, and press Ctrl-Tab to bring up a mode selection menu, and choose weight-painting mode. Shift-select the connecting eyelid bones from each side. Then search and run the command “Weights &gt; Assign From Bone Envelopes”.</p><p>Try clearing the bone selection with Alt-A and selecting one or more control bones and moving them around. The eyelid should move with them, but stays behind a bit; you would need to overshoot by a lot to make the eyelids meet for a blink. The weights were added according to the envelopes, but the existing weights did not change. The eye geometry was previously weighted to the head bone, so in order to give the new eyelid bones control of the vertices they are weighted to, we still need to erase the weights from the head bone on those vertices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8pgiDag9c4nhx4Vk" /><figcaption>Head weights</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r5zDRo6_aVaFx7UZ" /><figcaption>Head weights with eyelid subtracted</figcaption></figure><p>I introduced the Bone Envelopes settings to try to avoid weight painting as much as possible, but there isn’t a command to erase the envelopes from other bone groups, so you still need to manually erase the vertices from the head bone’s vertex group to match the weights added by the eyelid envelopes. This is the best I could do without adding a section on scripting.</p><p>To switch to an eraser, go to the Tool tab in the Right panel, and in the Brush Settings section, change the “Blend” property from “Mix” to “Subtract”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/0*ckiL8PwUjyPvBT2p" /><figcaption>blend setting dropdown</figcaption></figure><p>To work more slowly, try setting the “Strength” setting lower, and taking more clicks/strokes to approach the values you want.</p><p>If you Shift-Click a bone while you are in weight painting mode, the weights for that bone will be displayed. Selecting a bone with no vertex group will show the whole model in magenta. You can also select the vertex groups list in the Object Data properties tab, which can let you view and edit the weights for bones that are hidden.</p><p>Now you should do a test where you pose the head and eyelids to one side, just to check that there are no vertices left with no bone weights at all.</p><p>The lower eyelid can be created by following this process a second time; or by duplicating the whole set of bones, repositioning them on the surface, and renaming them (with “Lower” eyelid). If you duplicate, keep in mind that in order to reposition the control bones, you should select the control bone, as well as the ends of any connecting bones hidden under its base. Alternately, you could move just the control bones in pose mode (where the constraints will position the connecting bones), then select the control bones and connecting bones and run “Apply Selected As Rest Pose”.</p><p>Use Ctrl-Shift-C to Add Bone Constraints With Targets to add the Copy Position constraint, with the control bone at the head end selected with each connecting bone; and the Stretch To constraint with the control bone at the tail end selected with each connecting bone.</p><p>Set the Bone Envelope values as described above.</p><p>Run “Symmetrize” to create the mirrored bones for the other eye.</p><p>Run “Weights &gt; Assign From Bone Envelopes” with the lower eyelid connecting bones, and remove the influence from the head bone for those as well.</p><p>Now these eyelid bones are done and ready to keyframe.</p><p>These bones give you a lot of control over the eyelids; but that can be a lot to manage. These bones will have a lot of keyframes to copy just in order to blink. Something I encourage you to look up on your own is using Action Constraints on the control bones. Essentially you can create an animation (an Action) for the character that is just blinking with the eyelids, and then by adding an Action Constraint to each of the control bones, and referencing that action and its start and end frames, you can control how far through the animation the bones should appear. An additional bone can be created, and set as the target for those Action Constraints (or you could use the eye look target, for example), and then by animating the target bone, we can control how far through that animation the eyelids should currently be. It is a bit of a confusing indirection, but for blinking and reusable facial expressions, it can work well.</p><p><strong>Eyebrow Expression</strong></p><p>For the eyebrows, we can use the same system of control bones connected by stretching bones that we did for the eyelids. The eyebrows and eyelids can work together to form facial expressions along with the mouth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TYasxl7WKZSxcn8c" /><figcaption>eyebrows</figcaption></figure><p>If you are feeling more comfortable with weight painting, you can skip the Bone Envelope settings and paint in the bone weights manually.</p><p><strong>A mouth with posable lips</strong></p><p>In this section we will:</p><ol><li>finish the inside of the mouth with simple teeth</li><li>create a jaw bone</li><li>create a set of bones with control bones similar to the eyelids</li></ol><p>If you skipped the Shape Keys section above and your character doesn’t have an inside to their mouth yet, go back and follow that section to create the inside of the mouth now. We are going to use the same mouth, but add some teeth and gums inside.</p><p>Once you have the inside of the mouth cavity, we will add in top and bottom rows of teeth, with gums. The teeth rows will be separate meshes, and connected to the animation bones for the head and the bottom jaw. We won’t need to worry about bone weights on them, and we create gums just to cover the space above or below the teeth.</p><p>Place the cursor and add a new cube, then go into edit mode. Scale the whole thing down by pressing A, S, 0.01 (a tooth is closer to 2 cm across than 2 meters).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*Q29LIBdalQflmeBX" /><figcaption>small cube</figcaption></figure><p>Now let’s scale it shorter in the Y direction a bit more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*kbNwP-p8M0Zl0lr5" /><figcaption>a tooth yet?]</figcaption></figure><p>Select the edges following the X direction (with a box selection down the front with wireframe on, or by holding Alt-Ctrl and clicking one of them), and then use “Subdivide”. Open the redo command panel if it shows up collapsed, and set the “Number of Cuts” to 2. Now select all the edges that don’t follow the X direction, and then use Subdivide again (with Number of Cuts: 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*kEfPlWIPh6lrRAJw" /><figcaption>subdivided</figcaption></figure><p>Teeth are categorized into 4 types: incisors, canines, molars, and premolars. Incisors are the long-edged, square looking teeth in the front of your mouth; canines are the more pointy ones to the sides of those, molars are large, boxy ones in the back; and premolars are a bit more round, but also like molars. We are going to use this subdivided box to make one of each type, and then arrange and scale copies together. None of the types will need bottom faces, so delete the faces on the bottom of this subdivided cube. I set “Shade Smooth” so the teeth appear rounded. It can be handy to do a simple UV Unwrap on the subdivided box before making the types of teeth, in case you want to add them into the character’s texture map.</p><p>Here are the four types of teeth, made from the same subdivided box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/0*C7iSiHA_X8nNLB1Z" /><figcaption>an incisor, a canine, a molar (and a rounded molar)</figcaption></figure><p>Use a Mirror modifier, and arrange copies of these teeth to form the teeth of the bottom jaw. The teeth of the bottom jaw form a semicircle just inside the lips. You can make an arc first as a guide if you like. Use isolation mode, and the Alt-B frustum clipping to make it a bit easier to work where things are intersecting. Duplicate this row of teeth and move them up. Flip them vertically to become the top row of teeth. Select individual teeth with the L key, and adjust the scale. Scale the top center incisors a bit larger, and reposition the rest to fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cEO6cHs-zV3eDW8K" /><figcaption>teeth!</figcaption></figure><p>Copy a pair of edges making a V from one of the teeth on the top or bottom, and center those points. We are going to extrude this edge to create the gums.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f2bIzi7Jho-4sJLe" /><figcaption>V between the teeth</figcaption></figure><p>Select those edges and, from a top view, extrude them, adjusting the rotation, scale, and position at each step to create segments at the center of each tooth, and at the center of the space between each pair of teeth. When you get to the larger molars, you can make an extra segment for each tooth (a pair of edges before the tooth, 1/3rd along the tooth, and 2/3rds along the tooth). Select the pairs of edges you placed between each pair of teeth, then pull them up a bit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*V4ai9yU0kKKVn9PZ" /><figcaption>gum line, Vs pulled up</figcaption></figure><p>Grab the edges along the inside and outside and extrude them to make a bit more of the gums. Copy and flip this to make the gums for the top. Adjust the edge positions to match the different teeth positions.</p><p>Split this object into two so that the top and bottom teeth will be able to move independently. Name the objects “TopTeeth”, and “BottomTeeth”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tg1KPrcNBszT1-19" /><figcaption>top teeth, bottom teeth</figcaption></figure><p>As an additional step, I widened the inside of the mouth cavity to match the teeth a bit better.</p><p><strong>Make the jaw bone</strong></p><p>Place a new bone for the jaw; this can be created by extruding a bone from the head bone to the start position, and then extruding another to the tip of the jaw, and then deleting the first bone; or you could duplicate the head bone and set the parent to the head; or position the cursor and add a bone, and set the parent. Name this bone “Jaw”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*1w_59BQAkl_RshGE" /><figcaption>create the jaw</figcaption></figure><p>Select the bottom teeth and Shift-select the jaw bone. Then use Ctrl-P to set the parent and select “Bone”. Set the parent of the top teeth to the head bone in the same way.</p><p>At this point, the jaw will move the bottom teeth, but won’t open the lips at all. We need to paint the weights of the jaw to the new bone, and remove the weights of those points from the head bone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2JfPcyfmyCfSiYWU" /><figcaption>vertex weights of the jaw</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YI22wCDrE_2TGzev" /><figcaption>vertex weights of the head with jaw removed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kMKs8GB77ONPyUb1" /><figcaption>vertex weights of the jaw with the mouth open</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EdmAwMEmQ6PMQ2kc" /><figcaption>vertex weights of the head with the mouth open</figcaption></figure><p>They should look something like this. You can rotate the jaw open and continue painting, which can help get the lips weighted separately. Press Alt-R to reset the rotation. The bottom of the inside of the mouth should also be weighted to the jaw. This is probably the hardest step in this tutorial. Weight painting takes a lot of practice.</p><p>This is a bone-based mouth that works as a substitution for the Shape-Key version above, though it offers much less control for posing the lips. We can add deformation bones for the lips in the same way we did for the eyes. The only difference will be that the mouth is on the line of symmetry of the face. We’ll just make one half of the top and bottom lips, and use Symmetrize to create the other half.</p><p><strong>Lips</strong></p><p>Set Snapping Mode to “Face”, and duplicate one of the control bones from the eye. Rename it to “UpperLipControl”, and then delete the mirrored bone if one was created. Place it at the center of the upper lip. Then center the bone exactly by setting the “Head X” and “Tail X” values to zero in the Transform section of the Bone tab in the Properties view. Duplicate this bone and place it at the center of the bottom lip, and center it exactly as well. Rename this bone to “LowerLipControl”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mQutL4P-Bq9aJbA9" /><figcaption>center lip control bones</figcaption></figure><p>Duplicate the upper lip bone and name the duplicate “UpperLipControl_L”. Duplicate the lower lip bone and name the duplicate “LowerLipControl_L”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dOt4MbQ5B5LA_Mf4" /><figcaption>L lip duplicates</figcaption></figure><p>Now duplicate those bones twice more along the top lip, and bottom lip.</p><p>Turn off snapping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lrBH3vVf7XROd9nf" /><figcaption>lip control bones</figcaption></figure><p>As you did with the eyes, select the bases of pairs of control bones, and press F to create the bone between them, starting from the center of the lips. Rename these bones in the pattern of “UpperLip_0_L”, and “LowerLip_0_L”. Disable “Connected”, and set the parent of these bones to the head bone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TcuxVgM5xJ5d4rgV" /><figcaption>connecting lip bones</figcaption></figure><p>Switch to pose mode to add the bone constraints like we did for the eyes. For each connecting bone, select the previous control bone, then the connecting bone, and press Ctrl-Shift-C to add a bone constraint and select “Copy Location”. Select the next control bone, and the same connecting bone, and press Ctrl-Shift-C and select “Stretch To”.</p><p>Select all the connecting bones, and switch the armature Display As property to “Envelope”. Holding Alt when you hit Enter, set the Envelope Distance to 0.01, and the Radius Head, and Tail values to 0.001 for the lip control and connecting bones.</p><p>Switch back to edit mode and select all the mouth bones. Use “Symmetrize” to create the mirrored bones. All the bones named with “_L” will get mirror copies, and the two center ones will not. Check that symmetrize worked correctly and that the constraints also work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*ceueu-erXFO0rNot" /><figcaption>bones with constraints</figcaption></figure><p>Select the mesh in Weight Painting mode and Shift-select the connecting bones. Run “Weights &gt; Assign From Bone Envelopes”. Remove the weights from the head and jaw bones in weight-painting mode. Paint to adjust the weights and especially remove crossover between the top and bottom lips.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/0*-oWLw2hzcMlxvV_k" /><figcaption>mouth posed open</figcaption></figure><p>Adjustment can take some time, and be very frustrating because of all the concurrent visual systems involved. Take breaks as needed.</p><p>Now the mouth is ready to keyframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*96lY9r-zem8gZvdoxKwwxA.gif" /><figcaption>lip sync animation</figcaption></figure><p>For a little more help making some expressions, you might want to add some deformation controls on the cheeks. These can use the same construction principle as the eyelids, eyebrows, and lips.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pjjHtq8TlJ7WBkW-" /><figcaption>face cheek animation bones</figcaption></figure><p><strong>More things to try on your own</strong></p><p>Consider making an action the way that I suggested for blinking, but have that animation run through the set of phonemes. Then you can drive the mouth shape by syncing with a time in that action using the rotation or position of a bone.</p><p>Try making the bottom lip come down when the jaw opens by adding bone constraints to the control bones of the bottom lip.</p><p>Add a tongue.</p><p>Find a video clip of a character speaking or emoting (or just audio can work as well), and create an animation to match the dialogue or expressions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc240755bece" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Games With Me]]></title>
            <link>https://moletotem.medium.com/make-games-with-me-c5070eebc5bf?source=rss-2986c27f2929------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5070eebc5bf</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[skillshare]]></category>
            <category><![CDATA[blender]]></category>
            <dc:creator><![CDATA[elliott davis]]></dc:creator>
            <pubDate>Sat, 18 Aug 2018 20:00:15 GMT</pubDate>
            <atom:updated>2018-08-18T20:00:15.605Z</atom:updated>
            <content:encoded><![CDATA[<p>I want to teach a technique for getting started with making games. This is just the way I get started. And it’s not even the whole story for me. I reuse and modify things I’ve made before; or things I’ve found, or bought, or otherwise picked up that I’m comfortable with. A lot of my process of making games is discovering what’s useful for me, and comfortable for me. I want to encourage and enable people to use games as a medium for creative expression. And I think it’s important that we can all find different approaches, and then also find ways to work together.</p><p>I love collaborating. I want you all to make games with me.</p><p>There are lots of other options, and I encourage you to look up alternatives and find something that might suit your needs better. This is going to start very simple as well, so if you’re already set up and making your own games, you might not get anything from hearing this technique.</p><p>For me, games are about this union point of exploration, and expression through movement. I am most interested in making characters and animating them. Defining the character’s movement and interactions in a game is very much just an extension of animating — bringing a character to life.</p><p>I often found myself struggling very hard with filling out the rest of a game after creating a character and setting up movement and interaction systems. The experience could feel complete already to me, but I didn’t feel confident that anyone would accept it as finished like that. I was sure that other people needed there to be some reason to explore; something at the end of passages, and some way to complete the whole thing.</p><p>I’m not over that feeling yet, but I believe that game where all there is to do is move around can be complete. This interaction is pure and the experience is diluted with additions. If I want to sell a game, I might still consider adding some of the dilutions to meet the expectations of my imagined consumers though. I won’t think less of developers who feel they need to do that, or who do that because they feel the additions do make their game better.</p><p>My expressive movement exploration games center around a player character. Generally, they are a restricted to a side-on view, or let you move in a more three-dimensional world. My technique is to use 3D assets either way. It’s not too hard to restrict 3D movement to 2D later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*r44WzB3dGipX7nS6QKiBJg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*A5Kf7b0aRGg7LFXq5A2wCw.gif" /></figure><p>A lot of the life in these two gifs comes from the characters and their animations. I’m not going to get to character creation in this piece, but I feel like that’s actually a section that can be left out of the basics, and it’s also something that can be looked up separately, with many different techniques suited to individual developers’ preferences. I want to point out how the section of world you do see, and the sense you get of how the character moves practically force you to imagine going further, and what else might be off-screen. That is what draws me to want to develop games that focus on the movement of a character within a space.</p><p>I am going to cover:<br>➡︎How to get Unity and Blender, and some controls and functions in them<br>➡︎Adding and configuring components on objects in Unity<br>︎︎➡︎The parts of a behaviour script to be used in Unity<br>➡︎Creating a character movement script<br>➡︎A modelling technique to create a simple environment in Blender</p><p>After following along with this explanation, you should be in a position where you have a simple controllable character, and can begin elaborating and experimenting where your interests are in order to make something new.</p><p><strong>Get free tools (Unity, Visual Studio, Blender)</strong></p><p>Most of my game-making tools are free. I like to support the developers of tools that are useful to me, but I feel like the accepted industry standard tools are often priced geared towards either the studios employing developers, or individuals where this tool represents their specialty (if my work covers multiple fields of specialization, it’s difficult to justify owning or licensing expensive tools for each field, each comprising a fraction of my work). When I consider tools, I also want to know if I can later transfer my knowledge and skills to someone else. Free tools are always appealing in that I can more easily recommend them to new developers; there’s a wider audience for sharing my knowledge.</p><p>I use Unity, and I use Blender; both of which are free. I also use a tool that is not free, which advice and tutorials often take for granted. I can’t make games without a computer. Sometimes you can get a hand-me-down computer for free. Sometimes you need a very expensive computer. It depends on the project. I work on a macbook that is a couple years out of date. I aim to make games that don’t have high hardware demands to run, and I can usually get away with developing on a lower end computer.</p><p><strong>Download Unity here</strong>:<br><a href="https://unity3d.com/get-unity/download">https://unity3d.com/get-unity/download</a></p><p><strong>Download Blender here</strong>:<br><a href="https://www.blender.org/download/">https://www.blender.org/download/</a></p><p>You’ll also need something to edit a script with. Any text editor will actually be enough to get by, but you’ll probably want some of the features of code writing tools even if this is the first and only time you’ll use it. Visual Studio is included with the Unity installer by default and that is a good choice. I’m using a slightly smaller tool called Visual Studio Code.</p><p><strong>Using Unity</strong></p><p>After you install Unity, open it up. <strong>Make and name a new project</strong>. Naming things is actually very hard and it’s something you need to do <em>a lot</em> in game development; so you’re going to start right now. Do not accept “New Unity Project” and do not choose anything with “Test” in the name. Not even synonyms like “prototype”. It’s rarely appropriate to use the date, so avoid that too (it will be confusing later). Replacing assets named with the date, at a different date, without being able to rename them feels extremely bad. You can search for and use a title generator for some creative help, but I suggest thinking for a moment about how you feel, what you think is valuable or cool, what you want to evoke eventually. The binomial system is concise and fairly flexible; that’s why it’s used in naming organisms, and why it’s in fashion for games now. Find two words that sound nice together, evoke your interest, and are original (if you prefer to be original). If the name is a bit vague or ambiguous (it should be), you can take the project in a different direction without a lot of conflict. Projects often need to switch to a different name at some point before release; all you want is a good placeholder that doesn’t feel dissonant whenever you open it up again. Take as long for this as you need, but remember you can choose to be flexible.</p><p>Unity looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_mbUgRWxeRZF1xLLTWgkQ.png" /></figure><p>I’m going to make one recommendation for you to change the layout and that is to switch the Project view to “One Column Layout” (in the three lines menu in the top right corner), and put the Hierarchy view, Project view, and Inspector as columns left to right, on the right side of the Scene view. You can move views by dragging their tabs. Preview shapes will show docking positions as you drag. Views can also be left as separate windows from the Unity editor’s main window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rroJMUb_6JoHMjgCGhH_Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*0cQqGh5pRkMBqY19wmdJbw.png" /></figure><p>Right-click in the Hierarchy view and <strong>create a new 3D Object &gt; Cube</strong>.</p><p>In the Inspector view, <strong>press the “Add Component” button at the bottom and search for and select “Rigidbody”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*U6Qdza0as-eSJFp7sJr9Yg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*wB_2-n8VxViUUW4grBQVSw.png" /></figure><p>Press the play button in the top center and see that the cube falls out of view. Press the play button again to stop. The cube resets to the position it was before you hit play.</p><p>Right-click in the Hierarchy view and <strong>create a new 3D Object &gt; Plane</strong>.</p><p>See the “Transform” section at the top of the Inspector with the plane selected. This lists the position, rotation, and scale of the object. These values are <em>local</em> which means they are relative to the object’s parent.</p><p>If you still had the cube selected when you created the plane, it will be created as a child of the cube, which will look like this in the hierarchy. If that’s the case, click and drag the plane to the empty space below and release. When the cube and plane have the same indentation, neither will move with the other one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*QtC5Y2HE3WekkbeDLqHyNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*q5cEKSDZB0W4N9tqt8Epww.png" /></figure><p>Click the scale button in the top left. Drag the center box in the gizmo on the plane in the scene view to <strong>scale the plane</strong>. <strong>Make it larger</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*abDnikd-xJuyzqr9B7PRHg.png" /></figure><p>The Q, W, E, R, T, and now Y keys correspond to those buttons in the top left. When you have your cursor in a text field or another piece of the user interface that accepts keyboard input, the keys won’t toggle the tool mode. Select the cube again by clicking on its name in the hierarchy, or by clicking on it in the scene view.</p><p>Press W to switch to the move tool. You’ll see three coloured arrows. These are coloured to correspond to the 3-dimensional axes. R, G, B (Red, Green, Blue) maps to X, Y, Z.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pDw5afIVjbCXin8WbPPrRg.png" /></figure><p>Grab the green arrow and move the cube up, so it’s not intersecting with the plane. Move the cube right out of view actually.</p><p>Now press the F key. This can be used to center or <em>frame</em> the scene view on the selected object.</p><p>Press E to switch to the rotation tool. You’ll see a transparent sphere drawn over the cube, with coloured rings. The colours of the rings match the X, Y, and Z axes again. You can drag on those rings to rotate constrained to that axis. Drag anywhere else on the sphere to rotate it without that constraint.</p><p>Now you have a cube some distance above a big plane, and rotated at an angle. Press play again; it falls and bounces a bit when it hits the plane. When you hit stop, it resets to the state it was in before you hit play.</p><p>In the <em>project</em> view, right click and select Create &gt; Folder. Name the folder “Materials”. Right click the folder and select Create &gt; Material, then name the new material “Ground”. These names are not important.</p><p>Select the material and you can see details about it in the Inspector panel. One of the settings in there is called “Albedo” and has a white colour swatch next to it (and an eye-dropper next to that).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DuJ_BP6blcL_pRSMzd-M6w.png" /></figure><p>Click on the color swatch and a color picker window shows up. Drag the vertical hue slider on the right up to an orange, then drag in the large colour square to the left of that to pick a nice grey-brown (or whatever colour you like, really). Clicking outside the window will close it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*NxhCnfWJSmfXFZ7bLjMceg.png" /></figure><p>Now we want to put this material on the ground object. You can drag the material from the Project view onto the plane in the scene; drag it onto the plane’s name in the hierarchy; or select the plane and then find the “materials” section on the “Mesh Renderer” component, and expand that, then select the little target icon at the far right of the line where it says “Element 0” in that list. This brings up a window like the color picker, but showing all the materials available in your project so far. The one you created is in that list; you can use the search bar at the top when there are a lot of things to pick from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPqz-vsjCV2f0gVXXLcy9w.png" /></figure><p>Select your Cube then go to the Transform section in the Inspector view. Right-click the title (where it says “Transform”) to access the context menu, and then select “Reset”. This will set the local position and rotation values to all be 0, and local scale values to all be 1. (This resets the cube to be at the origin, with no rotation, and half submerged in the plane.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*W3U-zXzkDAIdjdaxcs3Szw.png" /></figure><p><strong>Create a capsule as a child of the cube</strong>. Set its position to (0,1,0); no rotation.</p><p><strong>Make a cube as a child of the capsule</strong> (this is going to be a nose to show you which way the capsule is pointing). <strong>Set its position to (0, 0.4, 0.4) and its scale to (0.3, 0.3, 0.3)</strong>. I’m going to change the name of that cube to “Nose”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*xPYmlz-9B9wx5TM3ifa4TA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*3kMdELWix-pJqzAxnLjtLQ.png" /></figure><p>All of these objects have a type of component on them called a Collider; the cubes have Box Colliders and the Capsule has a Capsule Collider. These are connected to the physics system in Unity, and they are responsible for causing the cube to bounce and stop when it fell to the plane earlier. The plane has one called a Mesh Collider, which means it uses the same geometry for collision as it does when it is drawn on the screen. The boxes, capsules, and spheres only match the shapes of their meshes (with parameters you can adjust if you want to see them not line up). Using boxes, capsules, and spheres usually means a lot less math for the physics system, which sometimes helps your game to run smoothly.</p><p>When we make a script to let you move and control it, we only want a collider on the root cube. Right-click on the title area of the Collider and select “Remove Component”. You could disable the component instead using the checkbox to the left of the title, if you thought you might need it again later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*5jDmFTigNhLQwNKgZVVttg.png" /></figure><p><strong>Remove the colliders from the nose and the capsule</strong>. Now select the root cube. Let’s rename this to “Player” at the top of the Inspector view. This is where our new script is going to go, but I want to change some more components first. Remove the Mesh Renderer, the Mesh Filter, and the Box Collider. Then add a Capsule collider. On the Capsule collider component, set the “Center” to have the values (0, 1, 0), and the height to 2; this should place the green capsule shape (which is a representation of the collider) to overlap with the capsule model that is a child of this object. On the RigidBody component, expand the “Constraints” section and check all three axis checkboxes next to “Freeze Rotation”. (This prevents the physics system from changing the rotation with collision forces. If you wanted to make a 2D game, you could also use the “Freeze Position” checkbox for Z to prevent the player from moving off of the X-Y plane) set the “Interpolate” dropdown to “Interpolate” and the “Collision Detection” dropdown to “Continuous Dynamic”. These are not very important, but might prevent some confusing behaviour later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*MQ-YIJbAVjjlt4shLhV1tA.png" /></figure><p>Another minor thing we can do to reduce some possible confusion later is create a frictionless physics material. When two objects bump each other in Unity’s physics system, the resulting forces involve the friction parameters of those objects. There are default values for friction, and the way we override them is to use something called a physics material. The only place I ever use one of these is when making a controllable character.</p><p>In the “Materials” folder in the Project view, right-click and select Create &gt; Physics Material. Name that “Frictionless” and then set everything on it to 0, and the dropdowns to “Minimum”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*O-3BwndFunLdALCeT34HzQ.png" /></figure><p>Select the “Player” and drop the physics material into the “Material” slot on the Capsule Collider component.</p><p>Next we’re going to create a script.</p><p><strong>Making character controls</strong></p><p>We are going to add a new script to the player object and start to make it into a controllable character. Press the Add Component button, but this time type in the name of a new script. If you use “PlayerCharacter”, there won’t be any suggested components but there will be an entry that says “new script”, with an arrow suggesting more options. Select that, and confirm the name (there is a drop down for script language, leave that as C#), then press “Create and Add”. Your script will show up in the root Assets folder in the project and Unity might take a moment to compile after you create it (the spinning thing in the bottom right corner will spin). You could also have created the new script through the project view (Right click, and select Create-&gt;New C# Script), which would let you control where the file goes in your project initially, but you would need to remember to add this component to the player object after creating it.</p><p>Our Player object has a new section in the Inspector view that matches what we called this script. We just made a new Unity component type. Just under the title section is a greyed out line that says “script” and to the right of that is a box that says “PlayerCharacter” with a script icon. If you click in that box, The C# file will be highlighted in the Project view (it will bounce with a yellow label). Open that script and have a look (it opens in a program based on settings in Unity).</p><p>If this section seems intimidating or boring, I’ve included the final script text at the end; feel free to paste that replacing the contents of this file and skip this part. You can return later to investigate how it works if that interests you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*TWfKLv2MD30q4LWAo06sFw.png" /></figure><p>adding members:</p><pre>public class PlayerCharacter : MonoBehaviour</pre><p>This line is a class declaration. Our script is a class in C#. A class is just a tool to do something with. It can have members (which are containers to store data), and it can declare functions which can be triggered to run. The part at the end that reads “: MonoBehaviour” is important because it indicates that this class is <em>inheriting</em> from another class called MonoBehaviour. This makes the class work as a component within Unity. It sets up the context for us to create functionality. It’s also important that the name of our new class matches the name of the file. The curly braces signal the beginning and end of the class after this line.</p><p>Add this new line after the opening brace of the class declaration</p><pre>public Rigidbody body;</pre><p>After you add this, save the file and switch back to Unity. There is a little spinning icon in the bottom right that shows up whenever you make changes to scripts. It will disappear after the code in your project is compiled. When it disappears, you might get new errors or warnings appearing in the Console window. This can help you catch some mistakes. Old errors disappearing from there can also show your corrections are compiled.</p><p>Look at the Inspector section for the new component again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*oUAdc6jKi8xNtxKE38_5tw.png" /></figure><p>The new line in the script added a new line here that is a slot or container for a Rigidbody component. Drag the Rigidbody component into this slot (either drag the title of that component, or drag this object from the Hierarchy view). Other things won’t go in here because the member we added is a container for a Rigidbody.</p><p>For the sake of the length of this tutorial, let’s add most of the ones I want you to have later right now. Switch back to where you were editing the script and add these members just after the RigidBody one.</p><pre>public float moveSpeed = 5;<br>public float rotationSpeed = 360;<br>public float gravity = 40;<br>public float jumpStrength = 10;<br>Vector3 velocity;<br>Vector3 moveInput;</pre><p>The last two variables you added (the Vector3 called velocity and the Vector3 called moveInput) don’t have the word public in front of them.</p><p>Save and switch back to Unity again. The public members appear here now too. Velocity and moveInput do not show up because they are not public. “float” is a container for a real number (one with a decimal place and a fractional element). You’ll be able to adjust these later inside Unity because we made them public. You can try changing them now if you want, to see how that works. Also you could make velocity or moveInput public to see how a Vector3 looks in the inspector (a Vector3 is like 3 floats stuck together and is used often for positions that should match the 3 spatial axes (X, Y, and Z). When we named the first one velocity, that hopefully suggests how we are going to use it: not as a position, but as the amount we want to add to the position (in X, Y, and Z) over time.</p><p>Now let’s use a function.</p><p>The template script implements two functions with comments above them. The compiler (and also the code editor) will be recognize the double slash as beginning a comment and treat the rest of that line as non-functional (it’s a message for when someone is reading the code). The text editor will also colour this line differently. Green is a pretty common default colour for comments.</p><p>The Start function has the comment above it that reads “Use this for initialization”. Start is a special name for a function to have in a Unity component. Since this class is a MonoBehaviour (which makes it a component you can add to GameObjects in Unity), The Start function is going to be run once at the start of this GameObject’s life in the game. Add this line inside the braces of the Start function:</p><pre>print(“PlayerCharacter Start”);</pre><p>Now save and return to Unity. Run the game and look for this message in the Console window.</p><p>This is an entry point to writing code. If you want to try out some math, you could do it in the Start function of a Unity component. You can create members that are the variables in an equation to let you tweak values and print out the result. There is a lot in the way; with the wait time on compiling and pressing play, and the overhead of needing to do work to format the math so it can be run as C# (this programming language). That might make it unappealing, but it might be better than the alternatives you know to be available.</p><p>Add these lines after that print line:</p><pre>if (body == null)<br>{<br>    body = GetComponent&lt;Rigidbody&gt;();<br>}</pre><p>In Start, this will check if that RigidBody slot is empty; and if it is, fill it with the result of a request to find the component on this object (so if it was not set in the editor, this will try to find it when the game runs).</p><p>Now let’s make some changes to Update. The comment over Update reads “Update is called once per frame”. This function is called repeatedly. If your game is running smoothly, that could mean 30 or 60 times per second. This function runs before the next frame of the game is drawn and displayed on the screen. If you want something to happen continuously (like say, the result of an equation with variables that you are changing in the Inspector view; which could maybe help you to understand how those variables are related to each other and the result) this is the place for it.</p><p>Add this line after the opening curly brace of Update:</p><pre>Vector3 moveInput = new Vector3(Input.GetAxis(“Horizontal”), 0, Input.GetAxis(“Vertical”));</pre><p>This is creating a new Vector3 (X,Y,Z values) which is done by listing the three values inside round brackets. We are making a <em>new Vector3</em>(X, Y, Z); The X and Z values are coming from another Unity class called Input, which has functions to retrieve the values of input axes, using the names of those axes in the function calls. The input axes are set up in Edit&gt;Project Settings&gt;Input if you want to learn about that, but these two are part of the defaults. The values are going to come from the keyboard (the arrow keys as well as w-a-s-d as another set of arrow keys,) and from any connected and supported gamepads or other joysticks. This vector is assembled with the “Vertical” axis mapping to the Z component, and the Y component is supplied as 0. The result of this script is going to have an object move around in 3D. In Unity, Y is up (the plane of the horizon is X and Z, and Y points up to the sky).You could print out the vector here if you want to test how that works.</p><p>Add these lines after the moveInput line:</p><pre>float magnitude = moveInput.magnitude;</pre><pre>//rotate stick input to camera orientation<br>Vector3 flatCamForward = Vector3.ProjectOnPlane(<br>   Camera.main.transform.forward, Vector3.up).normalized;<br>Quaternion camToCharacterSpace = Quaternion.FromToRotation(<br>   Vector3.forward, flatCamForward);<br>moveInput = (camToCharacterSpace * moveInput);<br>moveInput.y = 0;<br>moveInput.Normalize();<br>moveInput = moveInput * magnitude;</pre><p>This rotates the input from the joystick or keyboard to be relative to the main camera’s facing direction. First we store the magnitude or length of the input vector for later. The second line is a comment, which can help make sense of complicated code when coming back to it later. The next line uses a math function built into the Vector3 class called “ProjectOnPlane” to flatten the camera’s facing direction. Then we get the rotation to that direction. A quaternion is just a variable type that is used to store a rotation. A vector can be multiplied by a quaternion to rotate it. We rotate the input by the camera’s rotation to make it relative to the screen. Then we make that vector the same length as the original input’s magnitude. The main camera is whichever camera has the “Main Camera” tag set on it at the top of the Inspector view. Multiple cameras can have this set on them, in which case it is ambiguous which is the main camera, though it’s probably whichever was created last.</p><p>Next we we multiply the input by our character’s move speed, then set the velocity variable from that.</p><pre>moveInput *= moveSpeed;<br>velocity.x = moveInput.x;<br>velocity.z = moveInput.z;</pre><p>Then we rotate the character towards the input direction by the character’s rotation speed. The amount we rotate each update is calculated using something called Time.deltaTime. This is how much time has passed since the last time frame, or the time between frames. It’s in seconds and it’s usually a small value (if your game is running at 30 frames per second, it’s about 0.03 seconds; 1 second/ 30 frames).</p><pre>if (magnitude &gt; 0.001f)<br>{<br>    transform.rotation =<br>       Quaternion.RotateTowards(transform.rotation,<br>       Quaternion.LookRotation(moveInput), rotationSpeed *<br>       Time.deltaTime);<br>}</pre><p>If the player presses the space bar, we will set the vertical velocity to the character’s jump strength. And otherwise, apply the gravity variable to Y of the velocity.</p><pre>if (Input.GetKeyDown(KeyCode.Space))<br>{<br>    velocity.y = jumpStrength;<br>}<br>else<br>{<br>    velocity.y -= gravity * Time.deltaTime;<br>}</pre><p>We filled out this vector variable for velocity, but we haven’t connected it to anything. If you ran the game now, the character would turn, but it wouldn’t move anywhere. We are going to make this connection in a new function.</p><p>After the closing bracket for the Update function (and before the closing bracket of the class definition), Add these lines:</p><pre>void FixedUpdate()<br>{<br>    body.velocity = velocity;<br>}</pre><p>FixedUpdate is another special Unity function. If you make a function with one of the special names (and it has the right parameter list and return type), Unity will call that function when the circumstances apply. You can look up the list of special MonoBehaviour functions if you’re interested. FixedUpdate is like Update in that it will be called continuously, but it’s not going to be called every frame; instead it is called once for every physics update. The physics update happens at a different interval from drawing, and it has some separate special constraints. I want to apply the velocity to the character’s RigidBody here, just so it conforms to the timing of the physics system.</p><p>Now save the script and try it out in Unity. You should be able to move around and jump.</p><p>You may have played around enough to notice some problems: you can walk off the edge of the world; the camera doesn’t follow you; and you can still jump when you’re not touching the ground. The first one, Walking off the edge we can address when we make an environment in blender; the camera following you can be a bit complicated and I’m not going to cover that in this tutorial; but we can fix the grounded problem right now with some more work on this script.</p><p>Go back up to the top section of this class and add these three new members (after moveInput and before the Start function):</p><pre>public LayerMask groundLayers = ~0; //~0 means bitwise-not 0 (every mask layer enabled by default)</pre><pre>bool isGrounded;</pre><pre>float jumpInput;</pre><p>A LayerMask is a handy container for a selection of Unity’s Layers. I suggest saving and checking out how that looks in the Inspector view right now. This is going to be used in a raycast and it lets us easily ignore layers later on.</p><p>Now go to the FixedUpdate function, and before the “body.velocity = velocity” line, add this:</p><pre>//raycast to ground to see if we can jump</pre><pre>isGrounded = false;</pre><pre>var hits = Physics.SphereCastAll(transform.position + Vector3.up * 0.3f, 0.2f, Vector3.down, 0.3f, groundLayers);</pre><p>Physics.SphereCastAll is a function. What follows that, inside the brackets, separated by commas, are the parameters we are passing. The functions we’ve used so far don’t take any parameters (the declaration where we name the function ends in empty round brackets). RaycastAll takes a bunch. In fact, it has a bunch of versions that take different sets of parameters. This can be pretty confusing, but for this version, we are passing in a Vector3 which is the starting position, a a float (fractional number) for the radius or the thickness of the raycast, another Vector3 which is the direction the raycast is happening, another float pspecifying the length of the ray, and a LayerMask which controls which object layers this can ignore. All the parameters are separated by commas. We can use mathematical operations and the result will be calculated and then used as the parameter.</p><p>For the starting position we are passing in “transform.position”. “transform” is a way to access the Transform component that you can see in the Inspector view. All GameObjects necessarily have a Transform component, and this property is inherited from MonoBehaviour in our class (we didn’t create this member; we have it because this class is inheriting or deriving from MonoBehaviour).</p><p>A SphereCast is a special kind of raycast that has a thickness or radius. Imagine a sphere at the starting position being dragged to the end position making a capsule shape. The SphereCast function returns the list of all the things the sphere bumps into along that shape (anything with a collider on the layers we want to check). We are setting the radius to 0.2 units. The raycast’s length is set to 0.5 units, and it points down. If later, you want to change the size of the character, you might need to adjust these numbers.</p><p>For the layer mask we are passing in the one we made as a member of this class.</p><p>I want to use a SphereCast instead of a normal Raycast to reduce the problems with strangely shaped terrain. And I’d like to encourage you to experiment with the environments you create.</p><p>We can capture the list of hit objects by creating a variable and assigning the results of the function to that. “var” is a keyword you can use just like you could Vector3, or float, or LayerMask. When you use it, you are asking the compiler to figure out what type this variable needs to be. Since Physics.SphereCastAll returns a RaycastHit[] (an array of RaycastHits), hits is going to be that type. I used “var” because it was easier than writing “RaycastHit[] hits =“ and I felt it was clear from that line how that variable was going to be used.</p><p>We set the isGrounded variable to false before we do the raycast as part of our logic: we will assume the player is not touching the ground, and then check the raycast hits to prove they are.</p><p>We’ll use a loop to determine if the player is touching the ground. Add this after the raycast line:</p><pre>for (int i = 0; i &lt; hits.Length; i++)<br>{<br>    if (hits[i].collider.gameObject == gameObject)<br>        continue;<br>    if (hits[i].collider.isTrigger)<br>        continue;<br>    if (hits[i].normal.y &lt; 0.5f)<br>        continue;</pre><pre>    isGrounded = true;<br>    break;<br>}</pre><p>“for” is one way to make a loop in C#. Following the for keyword, the round brackets contain three terms separated by semicolons. The first term is for initialization and gets executed before the first loop; the second is a condition that is checked before each loop, and will cause the loop to exit if it evaluates to false; and the third term is an operation that is performed after each loop. You can put different code in each of these sections, but the standard usage of a for statement is to fill each section as follows: declare a counter variable and initialize it to where you want to start counting; supply the number you want to count to; and increment the counter. hits is an array. The first element in an array or list is numbered 0 (I’m sorry, I’m not going to explain this here, but you should look up why it’s not 1 if you’re interested). An array also has a property (essentially the same as a member in a class) called Length which holds the number of elements in the array. So by initializing the new variable “i” to 0 and saying we want to loop as long as i &lt; hits.Length, we will cover all the elements in the list. “++” is an increment operator (i++ is the same as saying i+=1, or i = i+1). Just like a function, or a class, curly braces mark the start and end of a loop after a for statement. The lines between the braces will be executed once for each iteration of the loop, and the value of i will increase each time.</p><p>Raycasts only hit colliders, and the collider that was hit is a piece of data in each RaycastHit element in “hits”. Inside this loop, we check to see if the GameObject this collider belongs to is the object our script is attached to (“gameObject” is another inherited property from MonoBehaviour, the same way that “transform” is), and if it is we continue the loop. Calling “continue” skips the rest of the code in the loop for this iteration and moves on to the next iteration. If the raycast hits the player, we want to skip that hit. We also check if the collider is marked as a Trigger, and continue if it is that as well. I also check the “normal” of the hit. This is the facing direction of the surface of the collider where the ray or sphere intersects it. I check the Y value of normal as an easy way to prevent the character from standing on steep slopes.</p><p>If none of those conditions are true, and we know this object is on the right layer (because we used a layer mask to specify which layers we wanted to raycast against), then whatever the ray hits is going to count as ground and we can set isGrounded to true. After that we can skip the rest of the loop iterations because setting isGrounded is the only thing this loop does. The “break” statement is like continue but it skips all the rest of the iterations (it exits the loop).</p><p>After that, we’ll add these lines:</p><pre>if (jumpInput &lt; Time.time + 0.1f)<br>{<br>    velocity.y -= gravity * Time.deltaTime;<br>}<br>else<br>{<br>    isGrounded = false;<br>}</pre><p>This is applying gravity to our velocity unless you just jumped. If you just jumped, you also shouldn’t be grounded.</p><p>Then we just need to modify the part in the Update function to use jumpInput and isGrounded. Add isGrounded as a condition in the if statement that is checking for input from the spacebar, and set jumpInput to the current time within that</p><pre>if (isGrounded &amp;&amp; Input.GetKeyDown(KeyCode.Space))<br>{<br>    velocity.y = jumpStrength;<br>    jumpInput = Time.time;<br>}</pre><p>We are adding “isGrounded” into the if statement so that the jump button won’t work if you aren’t also touching the ground. The double ampersand (&amp;&amp;) is a “logical and” which means both the left and right need to evaluate to true in order for the code inside the curly braces following the if statement to run.</p><p>Remove the else part of this with applying gravity because that is done in FixedUpdate now.</p><p>If you save that and give it a try in Unity, that should prevent the air jumps. That’s all the coding I’m going to cover.</p><p><strong>Here is the full text of the script we wrote:</strong></p><pre>using System.Collections;<br>using System.Collections.Generic;<br>using UnityEngine;</pre><pre>public class PlayerCharacter : MonoBehaviour<br>{<br>    public Rigidbody body;<br>    public float moveSpeed = 5;<br>    public float rotationSpeed = 360;<br>    public float gravity = 40;<br>    public float jumpStrength = 10;<br>    Vector3 velocity;<br>    Vector3 moveInput;<br>    public LayerMask groundLayers = ~0;<br>       //~0 means bitwise-not 0 (every mask layer enabled by default)<br>    bool isGrounded;<br>    float jumpInput;</pre><pre>    void Start()<br>    {<br>        print(&quot;PlayerCharacter Start&quot;);<br>        if (body == null)<br>        {<br>            body = GetComponent&lt;Rigidbody&gt;();<br>        }<br>    }</pre><pre>    void Update()<br>    {<br>        moveInput = new Vector3(Input.GetAxis(&quot;Horizontal&quot;), 0,<br>           Input.GetAxis(&quot;Vertical&quot;));<br>        float magnitude = moveInput.magnitude;<br>        //rotate stick input to camera orientation<br>        Vector3 flatCamForward =<br>           Vector3.ProjectOnPlane(Camera.main.transform.forward,<br>           Vector3.up).normalized;<br>        Quaternion camToCharacterSpace =<br>           Quaternion.FromToRotation(Vector3.forward,<br>           flatCamForward);<br>        moveInput = (camToCharacterSpace * moveInput);<br>        moveInput.y = 0;<br>        moveInput.Normalize();<br>        moveInput = moveInput * magnitude;<br>        moveInput *= moveSpeed;<br>        velocity.x = moveInput.x;<br>        velocity.z = moveInput.z;</pre><pre>        if (magnitude &gt; 0.001f)<br>        {<br>            transform.rotation =<br>               Quaternion.RotateTowards(transform.rotation,<br>               Quaternion.LookRotation(moveInput), rotationSpeed *<br>               Time.deltaTime);<br>        }<br>        if (isGrounded &amp;&amp; Input.GetKeyDown(KeyCode.Space))<br>        {<br>            velocity.y = jumpStrength;<br>            jumpInput = Time.time;<br>        }<br>    }</pre><pre>    void FixedUpdate()<br>    {<br>        //raycast to ground to see if we can jump<br>        isGrounded = false;<br>        var hits = Physics.SphereCastAll(transform.position +<br>           Vector3.up * 0.3f, 0.2f, Vector3.down, 0.3f,<br>           groundLayers);<br>        for (int i = 0; i &lt; hits.Length; i++)<br>        {<br>            if (hits[i].collider.gameObject == gameObject)<br>                continue;<br>            if (hits[i].collider.isTrigger)<br>                continue;<br>            if (hits[i].normal.y &lt; 0.5f)<br>                continue;<br>            isGrounded = true;<br>                break;<br>        }<br>        if (jumpInput &lt; Time.time + 0.1f)<br>        {<br>             velocity.y -= gravity * Time.deltaTime;<br>        }<br>        else<br>        {<br>            isGrounded = false;<br>        }<br>        body.velocity = velocity;<br>    }<br>}</pre><p>I took out the function comments from Unity’s script template, but you may want to leave them there if they help. Also it doesn’t matter if your braces go on the next line or at the end of the line, but it can be fun to argue about it.</p><p><strong>Blender; make a simple environment</strong></p><p>When you open blender for the first time, there is a scene with a cube. There is a tools panel open on the left. On the right is the Outliner at the top (which has some things in common with the Hierarchy view in Unity), and below that a Properties panel with settings (which has some things in common with the Inspector view in Unity).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHV3EiOvKyCJqkthSZGM_A.png" /></figure><p>From the central 3D view of the scene, and from the Outliner, you may see that there are some other things in the scene (a camera and a light). In the Outliner, you can click the eye icons to toggle object visibility. You can also toggle whether objects can be selected, and whether they will be rendered. Rendering in Blender is a feature I hardly ever use, but in a way, Blender is designed mostly around rendering. For my games, I use the modelling and animation features, and don’t explore much else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*2XZ_hAklnDtefkKHWP-uEA.png" /></figure><p>You can drag the middle mouse button in the scene view to orbit around the scene’s origin. Hold shift while you start the drag to pan instead. I often only use the trackpad on my computer, and Blender has nicely mapped two-dimensional, two-finger dragging to orbiting (and panning while you hold shift), except that it’s inverted from what I would prefer. In fact, a lot of the next controls are confusing to me. Left-click repositions a 3D cursor (the red and white circle), and right-click begins moving the selected object in screen space in a way that feels uncomfortable to me. Blender has a reputation for being extremely weird, but I still believe it is easier to learn than the other options I’ve used.</p><p>Open up File&gt;User Preferences and you can change some settings to match what I think is easier to use, and an easier transition from most other 3D software. Under the Input tab, in the top left, there is a Presets dropdown. I set that to Maya. I turn on the checkbox for “Emulate Numpad” (because my laptop doesn’t have a numpad); this maps the numpad key bindings (which are camera controls) to the number keys at the top of a keyboard, replacing quick layer controls. Then I scroll down a bit and turn on the checkbox for “Natural Trackpad Direction”. You should hit “Save User Settings” if you want these changes to persist the next time you open Blender.</p><p>Press the 1 key (on the numpad if you left that setting off), this shows the scene from the “front” view. The axes in Blender are colour coded like they are in Unity (RGB maps to XYZ). The red X axis is visible horizontally, and the blue Z axis is visible vertically, showing that we are looking down the Y axis. This is actually a very big problem: in Unity the Y axis was “up”, and now in Blender the Y axis is “forward”. This has a lot of very confusing implications and dealing with it is a bit of a mess no mater what.</p><p>Press the 7 key, this is an overhead view with forward pointing to the bottom of the screen. You can hold control and press 7 to get a view from below (and with forward now pointing off the top of the screen). Press 3 to get a view from the right. Using control to get a view from the left works for this as well, and works for the 1 key to get a view from the back.</p><p>Pressing 5 toggles the view between perspective and orthographic projection. Orthographic projection can be useful to line things up sometimes, but I find it hard to look at and almost always leave perspective on. 4 and 6 rotate the view left and right by 15 degree increments (these keys are to the left and right of the 5 key). 8 and 2 rotate the view up and down by 15 degree increments (they are above and below the 5 key, but only if you are using a numpad). Holding control for these keys will make the view pan in that direction instead of rotate.</p><p>The 0 key toggles into the view from the camera in the scene (even if it’s hidden), and control-0 toggles into using the position and orientation of a selected object for the view.</p><p>If we look at the Properties panel, just below the Outliner, it has a row of buttons at the top. Those are tabs. Press the one that looks like an orange cube to get to the Object properties. Here you can change the name, set which layers this object appears in (the little double grids of 5x2 grey boxes), and view or set a parent object. Setting parents in Unity is done visually in the Hierarchy view, but the Outliner in Blender doesn’t let you drag and drop like that, so things are a bit more complicated. The top “Transform” section may look familiar coming from Unity as well. If you scroll to the checkboxes at the bottom of this view, “Wire” and “X-Ray” are options that I use a lot. “Wire” shows the edges of the object’s mesh (in orange when the object is selected and in black otherwise); and “X-Ray” will cause the object to be drawn on top of other objects in the scene when it would be obscured behind them (particularly useful when creating a skeleton for animation inside the model of a character).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*6gShgxVDwecLfWBLmDrRug.png" /></figure><p>Select the cube and hit G (for “grab”, I guess); move the mouse around and see the object is moving with you. You can right-click to cancel this and leave the cube where it was; or left-click (or hit “Space”) to accept the move.</p><p>Press R and move the mouse to rotate the cube at its position. It rotates around the axis of the current view; press R again and the rotation mode toggles into another mode more like rolling a ball. Rotating has the same rules for cancelling with right-click.</p><p>Press S and scale the cube. Same rules for cancelling with right-click.</p><p>You can press X to bring up a prompt to delete the cube. Ctrl-Z to undo and bring it back.</p><p>Press A to toggle select all and select none.</p><p>Select the cube and hit Tab. This enters “Edit Mode”. Edit mode allows you to operate on the elements of the object’s mesh (for some objects that don’t have a mesh, edit mode will let you manipulate other elements of that object). Within Edit mode, there are three selection modes to work on the mesh: Vertex, Edge, and Face. Vertex should be selected by default, and you can press A to toggle select all and select none in order to see them lit up.</p><p>If you press the Z key, you can toggle a wireframe, transparent mode for the view. Now try pressing B to begin a box selection when you click and drag. Cover some of the vertices. After pressing B, hold shift while you click and drag to make this box remove vertices from the selection instead of adding them. If you hold shift and click vertices, you can add or remove them one at a time.</p><p>Press G and move this selection of vertices around. Press S and scale them. Now press Z to turn off the wireframe view, press Tab to leave Edit mode. Orbit around and look at the weird thing you made.</p><p>There are a lot more controls to cover, but I’m going to mostly stop at this so we can get back to our game in Unity soon.</p><p>Delete the cube with X. Now press Space which brings up a search bar. Start Typing “Add Cube” into that. This search bar is most of the reason I think Blender is easier to learn than other 3D modelling options; you can use this tool to rely on other parts of your brain and memory instead of needing to know where the buttons are or what the shortcut keys are. You can hit Enter to run the highlighted result, or click to select and run one in the results. The search window disappears and a cube shows up wherever your cursor was. If you want a cube at the origin, hit space and search “Snap Cursor to Center”, then add the cube.</p><p>The cubes in Unity are one unit across; in Blender they are two units across. So this cube is two Unity cubes tall for reference (which is also the height of our capsule). Let’s rename this cube to “PlayerSize” in the properties panel. Then let’s enter Edit mode and move the mesh up one unit but pressing G, Z, 1, and hitting Enter. Then let’s scale it to half the size on X and Y so it matches the shape of the player capsule more accurately. Press S, Shift-Z, .5 (period five), and hit Enter.</p><p>The scale in Unity is meant to be one unit equals one meter. A capsule in Unity is 2 meters tall by default (which is tall for a person, not average). I sometimes use one unit as one “tile”, or one half-character-height. Those are close to a meter, but inaccurate if you want to get into measuring things while producing game assets. 2D Unity games sometimes use a scale where one unit equals one pixel, but I find that makes my scenes feel very big and it makes them a little harder to navigate in the Scene view; I stick to one unit equals one tile when I make 2D games as well. Assets from other developers (if you were to find resources on the Asset Store, for example) will often adhere to one unit equals one meter, so that is a very practical scale to adopt.</p><p>Leaving this box as a reference shape, will let us consider the player’s size and default position while making the space. In Object mode, hit Space and add another cube by searching for “Add Cube”. This one will be a floor the character can walk on. In the properties panel, rename this object to “Floor”.</p><p>Enter Edit mode with this cube, select all the vertices (with A), and use Space to search for the command “Edge Collapse”. Now your cube is one vertex. Press 7 to view this mesh from above. Press G and bring the first vertex away from the center and press enter. Then press the E key to begin “extruding” a new vertex from the selected one. Move the mouse and click to place this vertex wherever you like. Press E again and extrude another. Use this to trace a shape. Try to make a path and come back close to the original vertex at the origin. Select the newest vertex at the end of your path and the original at the beginning and press F to create a face between them (if you have only two vertices selected, Blender can’t create a face and creates and edge instead). This closes your loop. Hold Alt and click anywhere on the path you made. Alt-click is loop select, and this should select everything. Press F to create a face over the whole shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CLRW4tpiuDUXLhfrivVRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_lyGD52Jj_2fQrkRZkDUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hO3sSVgpWQEo1i_bTqB_hQ.png" /></figure><p>These faces might be pointing down, and it can be hard to tell. Hit space and search for “Flip Normals”. When the lighting seems more consistent, they are probably pointing the right way. If you want to know for sure, you can press the N key to open another panel on the right side of the 3D view and scroll down to the “Shading” section. Turn on “Backface Culling”; now faces will appear invisible when viewed from their other side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*i9-nKCAHvyLM53dCXzwf9w.png" /></figure><p>Press K to use the “knife tool”. Click somewhere outside the shape and then do a series of clicks inside to trace out a region, and end outside again, and then press Enter. The bottom of the screen in the overhead view will be behind the player unless we move or rotate things. I want this region to be behind the player.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lomDNBEgvGufYEB4bHSwHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnpzHU_Ews_Equ9TGi1Haw.png" /></figure><p>Now enter the Face selection mode by pressing Ctrl-Tab and selecting “Face”, or by using this set of buttons under the main 3D view</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/136/1*2TU5-Jf3m6kPHjL2SBl-zg.png" /></figure><p>Select the face that is the region we just cut, and then extrude it one unit up by pressing E to begin extruding, then Z, and then 1. This will give inputs to the extrude command that is in progress; selecting the Z axis (up in Blender), and setting the distance to 1. Which makes the region into a ledge.</p><p>to get rid of the walls on the outside of the space, select the face at either end then hold Control and select the one at the other end, then hit X to delete them (selecting “Faces” in the delete options that pop up).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLXKQMlF7b-u0ycO7zX7og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDQudd1_58PV3Ihq4zxdng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXq11wD-BGc5y1TXwUav6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t4AZXelJIIhWau-u_v4uZw.png" /></figure><p>Select all faces (with A), and use Space to search for “Triangulate Faces”. Blender sorts out a bit of geometry with concave shapes. Converting it to triangles will ensure that is consistent when the model comes into Unity. Converting to triangles can make it harder to work with while you continue modelling though. You can convert a selection of triangles back into a single face with the F key (this will really only work for selections that are in a flat plane).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00RW9dfiKsmqZx_pX7yxfQ.png" /></figure><p>Hit Space and search for “Select Boundary Loop”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ibo_5jtbmvet42Gvqkql5A.png" /></figure><p>Press E to begin extruding, and then press Z and then 5. Press space or enter or left-click to complete this command. The faces of this extrusion should point into the center area if the ones in your floor shape pointed up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zs_7KP-LIa2ISY5eSBdy3w.png" /></figure><p>Hold control and press = (the + key) to grow selection. You should have the walls you extruded selected and not the floor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qy_ci_V0QXz9WZ5zMRAquA.png" /></figure><p>Press P to “separate” and choose “Selection”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEK4dAzIwb6LydbKQyqDAA.png" /></figure><p>Now you have two objects. The one created from the walls will probably be named “Floor.001” which is Blender’s convention for naming duplicated objects. You could change this object to be named “Walls”.</p><p>Let’s have a look at this in Unity next. There are two methodologies when using Blender and Unity: some developers like to save the Blender file right into the Unity project’s assets directories; and some prefer to save the Blender file in a separate location, and always export an asset into the project folders. Essentially, Unity can interpret a Blender file as a model (it does this using Blender’s default exporter), so saving the Blender file and switching to Unity can be a faster workflow for making changes. If you were only going to use the default export settings anyways, this might make sense for you. Most of my Blender friends recommend exporting (they also recommend setting up a script to make exporting to the project directory as easy as hitting Ctrl-S is, but I haven’t gotten around to ever setting that up after years of working with Blender). A saved Blender file is a little bigger and takes a little longer to reimport in Unity every time you make a change. That was what ended up making me choose exporting over saving in the project.</p><p>Save your Blender file somewhere (a good place for me is inside the Unity project, but outside of the “Assets” folder, in another folder I usually name “ArtSource”).</p><p>Choose File&gt;Export&gt;FBX to export, select the destination inside your Unity project (maybe make a “Models” or “Environment” folder to hold this), and choose a file name for the environment. Before you export, there is an important setting in the FBX exporter: in the “Apply Scale” dropdown, choose “FBX All”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNkLkVdYdxz9yOrCWPqZFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EOEThvnTg433KavtuFyWjw.png" /></figure><p>n Unity, find the model in the Project view and drag it into the Hierarchy view. You should get to see a neat effect called Z-fighting if your floor was built on the X-Y plane in Blender, and is totally flat, and your Plane in Unity is also at the origin. This effect happens due to some specifics about how things are rendered and how depth information is stored for the camera; it relates to the distance between the near and far clipping planes, but you should almost always see it on perfectly overlapping faces. Let’s delete or disable the plane we were using before, and then have a look at the hierarchy for the model we made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*t7L_SOFdms9LEzeFhTJlng.png" /></figure><p>The Camera and “Lamp” are in here; even if they were hidden in Blender. They also both adopted Unity components for Camera and Light respectively. This isn’t a feature I use ever, so I’m not clear on which settings in Blender will carry over to Unity, but I’m pretty sure some do (like Field Of View on Cameras, and Color on Lights).</p><p>This camera is actually interfering with the one we have in Unity already. It views the player from a different angle, and since it was created later; even though it has the same “Depth” or rendering priority, it is drawn over the other camera. Viewing the player from a different angle will work with the controls we made, so if you want to make positioning the camera part of your blender file, you can leave this one. Otherwise, I would disable it, or delete it in Blender. The PlayerSize reference should be matching the position and size of your player, but you’ll want to disable that. Drag the Ground material you made earlier onto the Floor object.</p><p>If you go back into Blender, unhide the Camera and Lamp, and then delete them and export again, after Unity re-imports the asset, those objects disappear from the hierarchy. The connection between the asset and the objects in the scene is a little complicated, but essentially, there are some changes that will be reflected on this object no matter what, and some that will only apply if the “prefab connection” is maintained. The names in the Hierarchy view appear in blue while the prefab connection applies, and they will be black (or sometimes red) when that connection is broken. If we had broken the prefab connection already, the light and the camera would have remained in the scene even though we deleted them from the asset. This would be true for meshes like the walls and floor as well (they would remain in the Hierarchy view), but the models could disappear. The objects would keep their MeshRenderer and MeshFilter components, but those relied on mesh assets; which would not exist in the asset anymore if we deleted them in Blender and exported again. The reason cameras and lights would remain, is that those components don’t rely on anything from the asset once the objects have their positions and orientations and get set up for the first time.</p><p>The thing to keep in mind as you make changes to your environment asset is that changes to a mesh will always be reflected in a MeshRenderer component, but changes to Objects (like changing their scale or position) might not be, if you have specified them within Unity in certain ways. If you select the “Floor” object, have a look at the Transform section in the inspector (it’s position is 0,0,0). Now move the object and see how the text for the values there become bold. The bold type is usually to indicate that this value has been changed from the values described in a “Prefab” (importing a model generates a special kind of prefab, and the asset appears as a prefab with meshes and other components as sub-assets). Right click on the “Position” label and choose “Revert Value To Prefab” from the context menu that appears there. The position values get reset and return to non-bold type. Moving (and rotating or scaling) objects are changes in Unity that override the properties of the imported model only in the scene.</p><p>Select the “Walls” object and disable the MeshRenderer component (So that the model is invisible, but the Object is still active). Now hold Shift and select the “Floor” as well. Press The “Add Component” button at the bottom of the Inspector view contents, and search for “Mesh Collider” to add that to both selected objects.</p><p>Select the parent object (“blenderwalls” was the name I chose for my exported asset and that named the root of the hierarchy for the imported objects). In the top right of the Inspector view, next to the name field, click the checkbox labeled “Static”. There will be a popup window asking if you want this to apply to this object’s children; choose yes. This is mainly to let the Physics system perform some optimizations knowing that these models will never move. This is not really necessary, but it’s a good practice for when your environment starts to get more complicated. You might get some errors appearing about not having UVs defined. If these bother you, you can press the dropdown arrow next to the “Static” checkbox and uncheck the “Lightmap Static” option. There is also a setting in the import settings on this asset that can generate UVs but I’m not going to cover Lightmapping at all.</p><p>Press play and see how the invisible walls block you from walking off the edge of the floor. There’s still no ceiling, so it’s possible you could jump out if the walls are short, or if the settings on your player script give you a strong jump. You can add a ceiling to the walls mesh in Blender if you feel that’s important.</p><p>That’s it, you’re started. Try changing the shape of the space you made. Add some new things. Start experimenting wherever your interest is, but you’re pretty much on your own now. If you have any questions ask me, but also ask google, ask your friends, and ask yourself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*mO3qub-aiat-EU_a5FW5Qw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5070eebc5bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Luck, Skill, Cancer, and Trial Runs]]></title>
            <link>https://moletotem.medium.com/luck-skill-cancer-and-trial-runs-a6aea3726ed5?source=rss-2986c27f2929------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6aea3726ed5</guid>
            <category><![CDATA[interdisciplinary]]></category>
            <category><![CDATA[skillshare]]></category>
            <category><![CDATA[collaboration]]></category>
            <dc:creator><![CDATA[elliott davis]]></dc:creator>
            <pubDate>Mon, 09 Apr 2018 15:12:57 GMT</pubDate>
            <atom:updated>2018-04-09T15:12:57.302Z</atom:updated>
            <content:encoded><![CDATA[<p>People tell me I should write. I am one of the people who tells me I should write. I have experience and things to say. I like talking, and I like writing. There are at least four or five articles I have been planning to make for several years, but I have never felt ready to write them, or that I had an appropriate place to share them. I made a personal website as a portfolio a few years ago and thought that would be where they go. But that also didn’t feel right, and I continued to put it off. I bring up the topics I want to write about in conversation whenever I get the chance, and sharing them with people in that way lets me evolve the ideas a little at a time. This is a story about jumping in instead of waiting for things to line up.</p><p>In 2009, my father was diagnosed with salivary gland cancer, and he was told that treatment for this kind was difficult. It had already spread to other systems in his body, and they estimated his time left in months. I wanted to make a card to wish him good luck; to acknowledge our helplessness in the face of this; and to try to prevent him from seeing this as something that was his fault or that he could have avoided. It was all chance; bad luck. I wanted to find a four leaf clover and put it on the card.</p><p>I had never found a four leaf clover before, but I had a dog that I walked regularly, and it seemed like searching for one was something I could fit into obligations I already had around school and work. I loved my dog; she was sweet, and smart, and full of energy. I walked and looked at the ground. There were lots of clovers around where I walked. I hadn’t considered it before, but they were along the sidewalks on most of the streets, and the park close to my house had them everywhere. My vision is good, but it was hard to look at clovers while we walked; I needed to go slow, and it helped if I crouched down or bent over. My dog needed to go fast, however. She was bored if I went slow, and she wouldn’t get enough exercise.</p><p>It felt cruel to compromise her time outside like that. A dog’s life can be short, and she was so patient while I was gone all day otherwise. At some point, I decided “If I’m going to search for a four-leaf clover, I need to do it at full speed, walking.” So I did this. For maybe a month, I scanned the grass I walked over or beside while my dog bounded ahead and pulled me along. Then I found one. I had to dive to stop the dog without losing it, but there it was; four leaves. I took it home and I made the card.</p><p>My time searching was enough to form a habit, so after giving the card to my father, I didn’t stop right away. Whenever I walked the dog, I looked at the grass. Pretty soon, I found a second one. A couple days later, a third. I found two in the same walk. It had gotten easier; by a lot. Especially after having tried so hard for the first one, this was very rewarding. I started to collect them and press them in books. Sometimes I saw clovers when I closed my eyes. I was trying to figure out why it got so much easier after I found the first one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A827sJzY5TE7__bbGNx1eg.jpeg" /><figcaption>this is actually a later clover from 2014</figcaption></figure><p>I’ve found hundreds now, and I know this is a skill you can practice. Multi-leaf clovers happen with the presence of a recessive gene. Generally the odds of a clover having four leaves is about one in ten-thousand, but since it’s genetic, you can isolate populations to encourage the trait. It seems wrong that this popular symbol of luck can just be gamed and harvested like this, and it seems wrong that I can “be luckier” with practice or training. I have some tricks for it that I could pass on to anyone.</p><p>I love to share techniques, and tricks, and mnemonics, and knowledge. When I get together to work on games with friends, we usually only talk. It feels more productive to me. To get us on the same page, or to catch up, or to hash out a new concept. Part of my organization for productivity is to collect things that would be useful to someone else. The way I solved a problem could help someone else solve the same problem. I love to talk to people who are new to games. Especially as the resistance to making your first games gets reduced with new and better tools, the perspectives of new developers seem increasingly fresh and diverse. Learning the skills to make interactive digital art when I was younger involved a lot of instruction, and a lot of practices you needed to follow just because that’s the way it is. It’s still like that now, but it’s getting better. The intuitions of new developers brings me joy, and makes me question my habits. Combining the experience from two perspectives can show the shape of something complicated. Interdisciplinary connections are important for innovation, and professional mobility is a very powerful phenomenon that can get very experienced people with different views together, and it’s something I’m very excited for. I want to facilitate that if I can. If my knowledge and tricks can help democratize game development, I feel like I could contribute to something good and worthwhile.</p><p>I attended the Game Developers Conference 2018. I got there via Adriel Wallick’s Train Jam. Leading up to the event in Chicago, I met a game developer who was also a Molecular Biologist specializing in cancer research. Assembling right before the train departed, I met a second developer who was also Molecular Biologist specializing in cancer research. I had a great time talking to both of them. We all joined separate groups for the game jam and though I talked some more with each of them during the trip, we didn’t talk much about game development techniques. During the conference, I talked with everyone I met.</p><p>Something changed in the way I talk to people this year. I’m very polite and consider people’s feelings when I take action. Previously, sensing that people I wanted to talk to were busy or uncomfortable meant that I would not talk to them; not interrupt them; avoid inconveniencing them; even when I didn’t feel like I would embarrass myself. This GDC, I just inconvenienced them anyways. Unless I sensed their discomfort strongly, I would say hello; I would catch a stranger’s eye; I would introduce myself to someone with the confidence that through conversation, I could make it up to them and make this conversation worth their time. I tried to take the conversations to topics people knew about, and asked questions so I could relate their experience to things I understood. I feel like I did this successfully. People I talked to seemed happier at the end of a conversation. I felt like I had made them calmer in the middle of an intensely social event. And I think I helped sort out a problem or two, or maybe contributed to the evolution of some ideas. I discovered that this is something I have boundless energy for. The benefit for me was in getting those diverse perspectives and experiences. This felt like interdisciplinary collaboration.</p><p>After the conference ended, developers who remained in San Francisco had a chance to hang out casually. I continued talking to whoever was around, but there are also some loosely organized events; one of which was Rich Lemarchand’s GDC Feet: a walk along the west shore beach and into the woods towards the Golden Gate Bridge. It opened with a little bit of guided meditation and some encouragement to open up and talk to each other. I talked to some new people, and talked about memories. I talked about my family. The last game we were invited to play, at the ending point of the walk, was to think of someone we loved, or someone close to us, and take a picture for them. At the same location, we distributed boxes of chalk and were encouraged to draw anything but the hashtag for the walk, since we weren’t super clear on if chalk drawings counted as graffiti or not. I think a lot of people made a drawing or wrote a message for someone and took a picture of that.</p><p>The person I chose was my father, who had died in 2011, much later than was expected. I had been scanning the grass as I always do. Thinking about how for the last four years, sometime during every GDC, I walk to the Golden Gate Bridge, and I look for four-leaf clovers here. I’d never found one. This could be a population thing. They feel more difficult than the clovers at home. The recessive gene could just be less present in this area. But also these clovers have a shape that I don’t have a trick for: their leaves are almost completely cleft; the shape is more like six leaves than three. And I haven’t seen what a four would look like yet. I want to find one and take a picture of it. I thought back to that difficulty for the first clover. I need to do it at full speed, walking.</p><p>I think about my clover search as a compulsion. I feel like I can’t stop myself sometimes, but it also always feels like something I can fit in. I’m already walking; it doesn’t slow me down. I let people I’m walking with know I’m doing it, so it doesn’t feel rude. It usually helps fill out a good conversation. It is a bit intense some times though; I can feel machinery engaging in my head; my eyes start to put themselves in the optimal positions to absorb patches of grass. It’s like a flow state: I can lose track of time. That’s fine when I’m walking somewhere, but here at the end of the walk, it felt like I would just lose time in this additional opportunity to talk with creative people. I stopped and reflected on that first clover.</p><p>I think the reason it got so easy after that — why the skill could start to develop — was that I’d demonstrated it was possible, and I had an example of what success could look like. Specifically for vision, I had something to match potential candidates against. I thought: “If I could see what a four-leaf version of these clovers looks like, maybe I could find one.” I took the chalk over to a cement canvas and sketched what it must look like. I fit four of the deep-cleft leaf shapes together. This pattern would be my new mental tool, standing in until I could replace it with the experience of seeing a real one. I started to search again. But when the machinery started to engage, I reminded myself of missing conversations with living people. I came back and took a picture of my sketch. A plan for something useful. And stopped to talk again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TpZ4mjWaoJn3EzGWyTUi1A.jpeg" /></figure><p>The thing that will cure cancer is absolutely creativity. Game development takes so much creativity. It takes knowledge of a lot of domains to be efficient or clever in your work. Once you are making games in any capacity or specialization, you have the opportunity to branch out; to change specialty. The crucible of the domains brings amazing smart people into your proximity. All you need is time to talk to them. The medium fosters creativity like no other, as long as we don’t stifle it with convention, or poor working conditions; as long as we are accepting and open to different experiences. Meeting scientists who also make games has given me so much hope. We have so much to share. I only want to make it easier for more people to participate.</p><p>A solution to a major problem sometimes needs a small model and a demonstration. Like my sketch for a clover, standing in and helping us see what a solution could look like; a new complex idea could be presented as a game. Interactivity and changes over time, different ways of seeing are the advantages of this medium. Leveraging that can allow people to convey concepts that are truncated or constricted when presented in other forms of media. I want us to use all the channels of communication we can find or invent.</p><p>I want to make an effort to encourage this right now. I can’t wait for things to line up and allow me to participate. I want to jump in sooner and start writing. And if this doesn’t feel right once I’ve started, maybe it can serve as a sketch and help me discover what I need to continue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6aea3726ed5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>