Ok, be patient with me, I’m new at this ![]()
I’m making my first person character crouch when the “c” button is pressed. I want to be able to press the button and the crouch animation be played and then the character comes back up to a standing position. The problem is, when I hit the C button, I get the first 3 frames of the animation, but nothing else! Yes, my animation wrap mode is set to “Once”.
function Update(){
// If you press Crouch
if(Input.GetButtonDown("Crouch"))
{
Crouch();
}
}
function Crouch()
{
arms.animation.CrossFade("MCArm_crouchAll", .1);
}
also, in this script, I have all the Character Movement scripting. I don’t know if this is how you’re supposed to do it, but it is how I did it, but I made it so that whenever a key is not being pressed, the idle animation is played:
function Update () {
//If no key presses
if(!Input.anyKey)
{
arms.animation.CrossFade("MCArm_idle", 0.2);
}
// If you are hitting "Forward"
if(Input.GetAxis("Vertical") > 0)
{
transform.Translate(0, 0, walkForwardSpeed*Time.deltaTime);
arms.animation["MCArm_walk"].speed = walkForwardAnimationSpeed;
arms.animation.CrossFade("MCArm_walk", .5);
}
//(ETC like this)
I don’t know if that is part of the problem or not, but I don’t think it is…
Come on guys...I'm really hitting a wall here...
– CG-DJHow do your other animations work? Are they having any problems? I know when I last imported models in fbx format that ALL the animations where botched. Also, try setting the crouch animation to loop, that might work.
– NegagamesThanks for the tip, but I fixed it. It was doing this cause I had another animation playing when no keys were pressed.
– CG-DJ