Game Development Reference
In-Depth Information
FIG 3.10 Positioning the camera
for a third-person view.
Listing 3.11 Adding Running and Turning Controls to a Character
private var speed = 0.01;
private var runspeed = 0.1;
private var turnSpeed = 20.0;
function Awake()
{
this.animation.wrapMode = WrapMode.Loop;
this.animation.Play("Idle");
}
function Update ()
{
if(Input.GetKey("up"))
{
this.animation.CrossFade("WalkForward");
this.transform.position + = this.transform.forward * speed;
}
else if(Input.GetKey("down"))
{
Search Nedrilad ::




Custom Search