- Home /
Question by
VicciGames · Oct 22, 2011 at 03:30 AM ·
animationspeedgroundedcharacter motor
Shift Sprinting Camera Animation Based on?
The question i would like to ask is this -
How would I reference to my character motor to check if "if grounded" and or if speed is > 0. If anyone these are true I would have my character animate at the "Cam Walk" animation.
Here's the script I currently have -
function Start () {
animation["Cam Walk"].wrapMode = WrapMode.Loop;
animation["Cam Walk"].speed = 4;
animation["Cam Walk"].layer = 1;
animation["Cam Walk"].blendMode = AnimationBlendMode.Blend;
}
function Update () {
if(Input.GetButtonDown("ADS")) {
animation.Play("Cam DOF");
}
if(Input.GetButtonUp("ADS")) {
animation.Play("Cam DOF Off");
}
// Walking and Running Anims.
if(Input.GetKeyDown(KeyCode.LeftShift)) {
animation.CrossFade("Cam Walk", 0.1);
}
if(Input.GetKeyUp(KeyCode.LeftShift)) {
animation.Stop("Cam Walk");
}
}
Comment
Your answer
Follow this Question
Related Questions
Handling Animation and movement speed 0 Answers
How to calculate speed without rigid body 0 Answers
Animated Billboard or Animated Model? 2 Answers
Animation speed (backward) 1 Answer
Character x-speed drops to fast 0 Answers