Animations Question

Hello Guys,

I am a nebiew in Unity 3D !

My Question was, what must i do in Unity to get a special Animations to a Charakter if i click of Keys ? (if i click W than the Charakter go ford, and if i click S the Charakter go up)

greet Tyrael

Hi, welcome to the forum!

You can use the Input manager (menu Edit > Project Settings > Input) to configure the control keys however you like.

Wow, thank you for your helping
but if i create a Walk Animation, how can i choose there that if i click of W that he make the special Animation ?

greet Tyrael

The animation.Play function plays a named animation from the object:-

animation.Play("walk");

Thank you for answer but i dont know where i need to write this code that he go of the Key W ?

Can you discrible me pls ?

greet Tyrael

Hi Tyrael, I’m a newbie like you I guess.
What helped me most until now is going trough some tutorials, doing that helps to answer most basic questions. For me a good start was http://www.learnmesilly.com there is a great tutorial that leads you trough creating a game, also the “playanimation” is covered.

Kind regards, Robert

Thank you for send the Link !

I try it with this book !

But do you know a answer of my Question ?

greet Tyrael

I realise not being very precise with the link. Being at that page, you will find several buttons, click the unity one. That will bring you to a free video tutorial set, I actually bought the book after working myself trough this free video’s; I think it’s a great next step.
For you animation, you will need to split them up in the import panel, then trough scripting you can call the different animations with a script.

Kind regards, Robert

Is it better to use the animation component with with a rigidBody for player movement. Or can I have an animation that works with the players local coords. Then move the player using world coordinates. Basically I’m trying something that looks like this:

function a_Walk(){
	//plays Walk animation.
	animation.Play("p_Walk");
	renderer.material.mainTexture = pWalk;
	// let's take the facing scale to move this monster. Like we do in old country.
	var walkVel = Time.deltaTime * p_movSpeed * renderer.material.mainTextureScale.x; 
	transform.position.x += p_movSpeed;
	}