Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 1190
Rep : 0
Join date : 2015-04-18
View user profile

I can't make it work

on Tue Apr 21, 2015 2:16 pm
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!
avatar
Member [Lv. 3]
Member [Lv. 3]
Posts : 45
Points : 1395
Rep : 3
Join date : 2015-08-30
Age : 23
Location : Melbourne
View user profilehttp://jakeaquilina.weebly.com/

Re: I can't make it work

on Thu Sep 24, 2015 7:04 pm




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 =)
Back to top
Permissions in this forum:
You cannot reply to topics in this forum