x


scripting Animations

My player model and animations are all done in blender with seperate animations, not all are 250 frames (which it seems to play them at automatically)

my Run is 60 frames and should loop can i write this in script maybe?

the majority of the rest are 250

ive tried this method it don't work...

http://unity3d.com/support/documentation/Manual/Animation%20Scripting.html

here's my script...

var walking = false;
var aiming = false;
var run = false;
var idle = true;


function Update () {

    if(walking == true && run == false){
        animation.CrossFade("fpsWalk", 0.2);
        idle = false;
    }
    else if(walking == true && run == true){
        animation.CrossFade("fpsRun", 0.2);
        idle = false;
    }
    else if(aiming){
        animation.CrossFade("fpsAim", 0.2);
        idle = false;
    }
    else if(idle){
        animation.CrossFade("fpsIdle", 0.2);
        run = false;
        walking = false;
        aiming = false;
    }
}

function FixedUpdate(){

    if(Input.GetKeyDown("w")){
        walking = true;
    }
    if(Input.GetKeyUp("w")){
        walking = false;
    }
    if(Input.GetKeyDown("q")){
        aiming = true;
        run = false;
    }
    if(Input.GetKeyUp("q")){
        aiming = false;
    }
    if(Input.GetButton("Run")){
        run = true;
    }
    else{
    idle = true;    
    }
}
more ▼

asked Mar 12, 2011 at 04:58 PM

Mike Ledwards gravatar image

Mike Ledwards
227 83 56 65

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

hi your problem is at the end of ur values of smoothness and speed you need to place f at the end like this:

if(walking == true && run == false){

animation.CrossFade("fpsWalk", 0.2f);

idle = false;

more ▼

answered May 12, 2013 at 12:56 PM

ScarStudios gravatar image

ScarStudios
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6531
x4780
x1322
x161

asked: Mar 12, 2011 at 04:58 PM

Seen: 1404 times

Last Updated: May 12, 2013 at 12:56 PM