FragMate CommunityLog in

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

Share

descriptionI can't make it work

more_horiz
Hi, I have problems with the animation.
Everything is working fine but when I
set the animation on "loop" when I press
"w" the animation starts but doesnt stop.
Any advise?
Thanks!

descriptionRe: I can't make it work

more_horiz




ok check the image provided, it is for the animator system, you are able to hook up your input axis with the animator to control the animations, as you can see i have Horizontal and Vertical assigned as 2 floats in my example. you are able to drive these with your player script like so


//take note in the animator i named them Horizontal & Vertical

Code:


Animator anim;
private bool jump = false;

void Start()
{
anim = GetComponenet<Animator>();
}

void Update()
{
anim.SetFloat("Horizontal", InputgetAxis("Horizontal"));
anim.setFloat("Vertical",  InputgetAxis("Horizontal"));
//this is how we are going to drive our animations
//for jump we can do the same thing with the boolean variable

if(Input.GetKeyDown(KeyCode.Space))
{
jump = true;
anim.setBool("Jump", jump);
jump = false;
}
}



now we have working movement and jump animations. if you need further assistance i am happy to explain more over skype if need be =)

_________________
https://www.youtube.com/channel/UCrS-nC8CYukMmhAKpyq6TCA
Permissions in this forum:
You cannot reply to topics in this forum