Question by
Boniface99 · Feb 03, 2017 at 08:47 PM ·
animationjavascriptnoob
Basic JavaScript animation question
Hi guys-
I'm a real noob (never done a Java script before) and I'm trying to work out where I made some mistakes here in getting my animation to work.
Here is the code that I'm using...
#pragma strict
private var speed: float = 0.2f;
static var anim: Animator;
function Start ()
{
anim = gameObject.GetComponent (Animator);
}
function Update ()
{
if (Input.GetKey("space"))
{
anim.SetTrigger("jump");
}
{
else if(Input.GetKey("left"))
}
this.transform.Rotate(Vector3.up, -1);
}
else if(Input.GetKey("right"))
{
this.transform.Rotate(Vector3.up, 1);
}
if(Input.GetKey("up"))
{
this.transform.position += this.transform.forward * speed;
anim.SetBool ("isWalking", true);
}
else if(Input.GetKey("down"))
{
this.transform.position -= this.transform.forward * speed;
anim.SetBool ("isWalking", true);
}
else if (Input.GetKeyUp("up") || Input.GetKeyUp ("down"))
{
anim.SetBool ("isWalking", false);
}
}
This are the errors I get...
And I got the instructions on the animation from this document:
http://files.holistic3d.com/Tutorials/CharacterController.pdf (pgs 11 & 12 of the pdf)
Any assistance you could give would be appreciated. I'm pretty stuck here.
Thanks!!!
animerrors.png
(88.6 kB)
Comment
Your answer
Follow this Question
Related Questions
JavaScript taken from the web isn't working. Help 0 Answers
How to make different game routes available depending on players previous choice? 0 Answers
Help with variables 1 Answer
Rootmotion fall 0 Answers
Need help with automatic weapon firing! 2 Answers