Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Walking Animations


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Endeo   Members   -  Reputation: 103

Like
0Likes
Like

Posted 09 June 2012 - 04:53 PM

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 Posted Image

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

Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 6655

Like
2Likes
Like

Posted 09 June 2012 - 09:26 PM



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, 09 June 2012 - 09:31 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS