FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Walking Animation Script(Help)

Share

descriptionWalking Animation Script(Help)

more_horiz
I have just created the walking animation script and have made it a child of the gun M4A3. I have made the key(w) which will start the animation, but when i click play the animation is already going and does not stop and it does it even if i don't press "w".
Thanks, i can post script etc...
This is in relation to video 3 of the FPS Tutorial.

descriptionRe: Walking Animation Script(Help)

more_horiz
Make a new script, and use this to stop animations. Attach this script to you're gun.

Code:


    function Update()
{
 if(Input.GetKeyUp("w"))
 {
  // Plays the _____ animation - stops all other animations
  animation.CrossFade("idle");
 }
}

descriptionRe: Walking Animation Script(Help)

more_horiz
I use this Script created by me Very Happy:


FIRST SCRIPT (PLAY ANIMATION):  

Code:

var AnimationClip : AnimationClip ;
function Update() {

if (Input.GetKeyDown (KeyCode.W))
{
    animation.Play();
 
}

}





SECOND SCRIPT (STOP ANIMATION):

Code:

var AnimationClip : AnimationClip ;
function Update() {

 if (Input.GetKeyUp (KeyCode.W))
{
    animation.Stop();
 
}

}


Last edited by developer23 on Thu Jun 05, 2014 9:06 am; edited 1 time in total

descriptionRe: Walking Animation Script(Help)

more_horiz
It essentially does the same thing. Also developer 23, I reccomend you use animation.crossfade insdead of animation.play.

descriptionRe: Walking Animation Script(Help)

more_horiz
@MisterNinjaBoy wrote:
It essentially does the same thing. Also developer 23, I reccomend you use animation.crossfade insdead of animation.play.
Thanks a lot Very Happy

descriptionRe: Walking Animation Script(Help)

more_horiz
Hello masterninjaboy, I'm new here and I love your videos!

Instead of the your gun models, I tried animating a simple cuboid with all the other steps done exactly the same. The script is exactly the same too, but the animation keeps running as long as the 'Animator' is a child of the Cuboid, and then doesn't work at all when I remove the 'Animator'. I tried many things with my scripts, nothing works

descriptionD:

more_horiz
@MisterNinjaBoy wrote:
Make a new script, and use this to stop animations. Attach this script to you're gun.

Code:


     function Update()
{
 if(Input.GetKeyUp("w"))
 {
  // Plays the _____ animation - stops all other animations
  animation.CrossFade("idle");
 }
}



Whenever I try press w the console says
The animation state M9IdleAnimation(My Walking Animation) could not be played because it could not be found. ):
My idle animation is called IdleM9 just to be clear about that.
It is extremely annoying because I cannot get 1 stupid animation to play.
PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11

descriptionRe: Walking Animation Script(Help)

more_horiz
didn't work Neutral
i created a new java script and pasted the one u posted and nothing changed
What do i do ?

descriptionRe: Walking Animation Script(Help)

more_horiz
@DARTHVADEREX wrote:
didn't work Neutral
i created a new java script and pasted the one u posted and nothing changed
What do i do ?

Put the script into the object

Last edited by developer23 on Tue Jul 22, 2014 11:20 am; edited 1 time in total

_________________
Game Developer
YouTube Channel: https://www.youtube.com/channel/UCra7PcIl3WqSsIChgIAmWrA
Website: http://masterdevelopers.altervista.org/

descriptionRe: Walking Animation Script(Help)

more_horiz
@DARTHVADEREX wrote:
didn't work Neutral
i created a new java script and pasted the one u posted and nothing changed
What do i do ?

And try this script

Code:

var AnimationClip : AnimationClip ;
function Update() {

if (Input.GetKeyDown (KeyCode.W))
{
    animation.Play();
 
}

}

_________________
Game Developer
YouTube Channel: https://www.youtube.com/channel/UCra7PcIl3WqSsIChgIAmWrA
Website: http://masterdevelopers.altervista.org/

Permissions in this forum:
You cannot reply to topics in this forum