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. 1]
Member [Lv. 1]
Posts : 4
Points : 1648
Rep : -1
Join date : 2014-01-25
View user profile

animation setup script needed

on Tue Jun 03, 2014 9:02 am
i've already made a walking animation, a idle animation, a sprint (run) animation and a jump animation. now i just need a animation setup script who is easy to use XD.


Thanks for helping me  Wink
avatar
Admin
Admin
Posts : 608
Points : 3170
Rep : 406
Join date : 2013-12-11
Age : 21
View user profilehttps://www.youtube.com/user/misterninjaboy

Re: animation setup script needed

on Tue Jun 03, 2014 5:15 pm
Message reputation : 67% (3 votes)
Code:

    function Update()
{
 if(Input.GetKeyDown("w"))
 {
  // Plays the _____ animation - stops all other animations
  animation.CrossFade("walk");
 }
}

Well here's the script for animsetup that I use for my fps tutorial series. This is pretty much the simplest it gets.. I changed animation.play to animation.crossfade, to transition animations more smoothly. Attach this script to you're object with the animations you want to play, and don't forget to replace the key input you want it to play on, and the animation name.

ALSO, to stop anims you can use this:
Code:

    function Update()
{
 if(Input.GetKeyUp("w"))
 {
  // Plays the _____ animation - stops all other animations
  animation.CrossFade("idle");
 }
}
Back to top
Permissions in this forum:
You cannot reply to topics in this forum