- Home /
Help play animations medium-difficulty
Hi I am from Argentina, I want to ask here because I do not get many answers in Spanish-speaking forums, sorry my bad English is the google translator lol My problem is that I have some animations and with very basic script, which only serve to make walking animations, well I want to know how to make when recharge not cut the animation when I press w (animation walk and walk with the character controller ) is to say that when I press "r" run the reload animation and if I press "w" to walk but keep the animation of "r" to the end,
Answer by getyour411 · Jan 17, 2014 at 03:30 AM
If you are using Mecanim, check out Blend Trees. If you are using Legacy, check out CrossFade and animation layers
Answer by belvita · Jan 17, 2014 at 03:43 AM
**Put the code below inside Update function havent tested the code but it should work**
public GameObject mygameobject;
if(Input.GetKey("w")) {
if(!mygameobject.animation.IsPlaying("urWalkAnimationName"))
{
mygameobject.animation.Play("urWalkAnimationName");
animation["urWalkAnimationName"].speed= 0.4f;
} }
if(Input.GetKey("r")) {
{
if(!mygameobject.animation.IsPlaying("urRunAnimationName"))
{
mygameobject.animation.Play("urRunAnimationName");
animation["urRunAnimationName"].speed= 0.4f;
} }
Your answer
Follow this Question
Related Questions
Child Obj Animation Problem 0 Answers
Blurry animations on android 0 Answers
How I can identify if the player is going up or down? 1 Answer