Sign in to follow this  

Walking Animations

This topic is 2016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone.

I'm currently working on moving and animation a character in unity and I've stumbled upon something I can't quite figure out, at least not in an easy way.

Basically, my character can move in 8 different directions using the WASD keys and always rotates towards the mouse, the camera is position usually top-down (think AlienSwarm).

Now the thing I'm wondering is, I want my character to do 4 different kinds of animations, walking forward, backwards and sidestepping left/right. But how does the game know when to use which animation? For example if my character was looking right was I was pressing A, how does the game know to do a backwards animation instead of sidestepping?

So basically I guess I need to figure out where my character is looking and compare it to where my character is moving but I'm not entirely sure where to start with this, any help would be much appreciated [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]

I can send some screenshots if there's some confusion about how exactly the game looks like.

Share this post


Link to post
Share on other sites
[media]http://www.youtube.com/watch?v=GYZkwbg2T2s[/media]

You can name your animations in Blender (and probably other 3d tools aswell) and call them from your unity scripts, (watch the video and it shows you how its done).

Edit: as for figuring out which direction you're moving in relative to the direction you're looking in you can get the angle between the look vector (the direction your character is facing) and the movement/velocity vector (the direction it is moving) and go from there.
http://forum.unity3d.com/threads/52930-Vector3.Angle%28%29 Edited by SimonForsman

Share this post


Link to post
Share on other sites

This topic is 2016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this