Quantcast
Channel: Latest Questions by GraviterX
Viewing all articles
Browse latest Browse all 122

Animator Scripting

$
0
0
Hey guys. I've been trying to learn to make a basic movement script with the animator. I'm new to this, and not sure how it works yet. Hopefully someone can help. In this script, I want certain states in the Animator component to play when the player presses certain buttons. I'm getting the following errors: 1. Animator Motions.js(30,17): BCE0005: Unknown identifier: 'animator'. 2. Animator Motions.js(30,31): BCE0005: Unknown identifier: 'Walking'. 3. Animator Motions.js(34,31): BCE0005: Unknown identifier: 'Running'. 4. Animator Motions.js(38,31): BCE0005: Unknown identifier: 'Idle'. 5. Animator Motions.js(42,31): BCE0005: Unknown identifier: 'WalkingBackwards'. 6. Animator Motions.js(46,31): BCE0005: Unknown identifier: 'LeftStrafe'. 7. Animator Motions.js(50,31): BCE0005: Unknown identifier: 'RightStrafe'. The Script: var isWalking : boolean; var isWalkingBackwards : boolean; var isStrafingRight : boolean; var isStrafingLeft : boolean; var isRunning : boolean; var isIdle : boolean; // NOTE: The first set of IF statements in Update() are for boolean variables, // the second is for controlling animations. function Update() { if(Input.GetKeyDown (KeyCode.W)) { isWalking = true; } if(Input.GetKeyDown (KeyCode.S)) { isWalkingBackwards = true; } if(Input.GetKeyDown (KeyCode.D)) { isStrafingRight = true; } if(Input.GetKeyDown (KeyCode.A)) { isStrafingLeft = true; } if(isWalking == true) { animator.Play(Walking); } if(isRunning == true) { Animator.Play(Running); } if(isIdle == true) { Animator.Play(Idle); } if(isWalkingBackwards == true) { Animator.Play(WalkingBackwards); } if(isStrafingLeft == true) { Animator.Play(LeftStrafe); } if(isStrafingRight == true) { Animator.Play(RightStrafe); } }

Viewing all articles
Browse latest Browse all 122

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>