Game Development Reference
In-Depth Information
from side to side (like waving past traffic), and also rotate it (as though your
outreached hand is turning a knob). Each distinct movement is called a
degree of freedom (DOF). Therefore, the shoulder has three DOFs: two that
translate the attached segment and one that rotates it.
Unity Hands On
Inverse Kinematics
In this hands-on session you will learn how to implement simple inverse
kinematic algorithms to control the angle and direction of a character's
arms and weapon. In this workshop, the mouse will be used to position
a target on the terrain. Inverse kinematics will be used to position the
character to be aiming at the target.
Step 1. Download Chapter Three/ from the Web site.
Unzip and open the project in Unity. The scene will contain the
animated character from the last workshop.
Step 2. The first thing we are going to do is add something for
the character to aim at on the terrain. To do this, the mouse will
be used as a pointer. Where the mouse is clicked on the terrain,
a target object will appear. This object will be a simple sphere.
To achieve this, modify the animationControls script to that
in Listing 3.12 .
Listing 3.12 Script to Create a Target Object at the Mouse
Location on the Terrain
private var speed = 0.01;
private var turnSpeed = 20.0;
private var aimPoint: GameObject;
function Awake()
this.animation.wrapMode = WrapMode.Loop;
aimPoint = GameObject.CreatePrimitive(PrimitiveType.
aimPoint.renderer.material.color = Color.magenta;
//remove collider so sphere doesn'treact to physics
function Update ()
Search Nedrilad ::

Custom Search