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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » Player Animation Setup, ADVANCED

Player Animation Setup, ADVANCED

Is this a good script?

86% 86% [ 6 ]
14% 14% [ 1 ]
Total Votes : 7

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Player Animation Setup, ADVANCED on Sun Apr 06, 2014 5:32 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
This player animation setup is all in one, it will transition your animations nicely. It won't be choppy at all. As long as your animations aren't choppy this script will allow you to setup your player..
I did make this script, this is not anyone elses..
Instructions:
Make new JavaScript (name whatever)
Copy the code (Below)
Attach to player (has to have first person controls or third person controls.
Then assign the variables your animations
walkb: walk backwards
walkf : walk forwards
rsidestep : right side step
lsidestep : left side step
idle: idle animation
then play your game!

Code:
#pragma strict
var idle : Animation;
var lsidestep : Animation;
var rsidestep : Animation;
var walkf : Animation;
var walkb : Animation;

function Update () {
if(Input.GetKeyDown("a")) {
lsidestep.CrossFade(lsidestep.name);
}
else {
lsidestep.CrossFade(idle.name);
}
if(Input.GetKeyDown("w")) {
walkf.CrossFade(walkf.name);
}
else {
walkf.CrossFade(idle.name);
}
if(Input.GetKeyDown("s")) {
walkb.CrossFade(walkb.name);
}
else {
walkb.CrossFade(idle.name);
}
if(Input.GetKeyDown("d")) {
rsidestep.CrossFade(rsidestep.name);
}
else {
rsidestep.CrossFade(idle.name);
}
}








Please show your support by leaving a nice comment below
thanks
-BryceCain25

View user profile

2 would this script interfere with motor ? on Mon Apr 07, 2014 8:03 am

sirpker7


Member [Lv. 1]
Member [Lv. 1]
bump

View user profile

3 Re: Player Animation Setup, ADVANCED on Mon Apr 07, 2014 5:35 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
no this would not, this would just play animations as the motor is running the Movement, it should work

View user profile

4 Re: Player Animation Setup, ADVANCED on Mon Apr 07, 2014 6:03 pm

Well crossfade is the best way to play anims, especially to give it a good transition, and a smooth effect. But i recommend you also do something like this for crossfade, so you can limit/ increase the time for the animation to fade (for each certain one.):

Code:
animation.CrossFade("Walk", 0.2);

View user profile http://www.youtube.com/user/misterninjaboy

5 Re: Player Animation Setup, ADVANCED on Mon Apr 07, 2014 6:04 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
MisterNinjaBoy wrote:Well crossfade is the best way to play anims, especially to give it a good transition, and a smooth effect. But i recommend you also do something like this for crossfade, so you can limit/ increase the time for the animation to fade (for each certain one.):

Code:
animation.CrossFade("Walk", 0.2);
Ahh! This looks alot better Smile Thank you

View user profile

6 Re: Player Animation Setup, ADVANCED on Thu May 29, 2014 4:40 am

Survivor


{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Please help me guys does any one know how to make a flying vampire as a 3rd player here is a video for it:
           

And one more thing: how to make it attack the player as an enemy?  scratch 

View user profile

7 Re: Player Animation Setup, ADVANCED on Thu May 29, 2014 11:54 am

Survivor


{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
BryceCain25 wrote:This player animation setup is all in one, it will transition your animations nicely. It won't be choppy at all. As long as your animations aren't choppy this script will allow you to setup your player..
I did make this script, this is not anyone elses..
Instructions:
Make new JavaScript (name whatever)
Copy the code (Below)
Attach to player (has to have first person controls or third person controls.
Then assign the variables your animations
walkb: walk backwards
walkf : walk forwards
rsidestep : right side step
lsidestep : left side step
idle: idle animation
then play your game!

Code:
#pragma strict
var idle : Animation;
var lsidestep : Animation;
var rsidestep : Animation;
var walkf : Animation;
var walkb : Animation;

function Update () {
if(Input.GetKeyDown("a")) {
lsidestep.CrossFade(lsidestep.name);
}
else {
lsidestep.CrossFade(idle.name);
}
if(Input.GetKeyDown("w")) {
walkf.CrossFade(walkf.name);
}
else {
walkf.CrossFade(idle.name);
}
if(Input.GetKeyDown("s")) {
walkb.CrossFade(walkb.name);
}
else {
walkb.CrossFade(idle.name);
}
if(Input.GetKeyDown("d")) {
rsidestep.CrossFade(rsidestep.name);
}
else {
rsidestep.CrossFade(idle.name);
}
}








Please show your support by leaving a nice comment below
thanks
-BryceCain25
I've grapped the animation clips but for some reason i can't drag them into the field that requests them, can you help me gyus with that by telling me if i am missing something ?  monkey 

View user profile

8 Re: Player Animation Setup, ADVANCED on Sun Jun 01, 2014 12:47 am

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
servival wrote:
BryceCain25 wrote:This player animation setup is all in one, it will transition your animations nicely. It won't be choppy at all. As long as your animations aren't choppy this script will allow you to setup your player..
I did make this script, this is not anyone elses..
Instructions:
Make new JavaScript (name whatever)
Copy the code (Below)
Attach to player (has to have first person controls or third person controls.
Then assign the variables your animations
walkb: walk backwards
walkf : walk forwards
rsidestep : right side step
lsidestep : left side step
idle: idle animation
then play your game!

Code:
#pragma strict
var idle : Animation;
var lsidestep : Animation;
var rsidestep : Animation;
var walkf : Animation;
var walkb : Animation;

function Update () {
if(Input.GetKeyDown("a")) {
lsidestep.CrossFade(lsidestep.name);
}
else {
lsidestep.CrossFade(idle.name);
}
if(Input.GetKeyDown("w")) {
walkf.CrossFade(walkf.name);
}
else {
walkf.CrossFade(idle.name);
}
if(Input.GetKeyDown("s")) {
walkb.CrossFade(walkb.name);
}
else {
walkb.CrossFade(idle.name);
}
if(Input.GetKeyDown("d")) {
rsidestep.CrossFade(rsidestep.name);
}
else {
rsidestep.CrossFade(idle.name);
}
}








Please show your support by leaving a nice comment below
thanks
-BryceCain25
I've grapped the animation clips but for some reason i can't drag them into the field that requests them, can you help me gyus with that by telling me if i am missing something ?  monkey 
ummm...? Unless you really messed up and corrupted the files on import, i really don't know what to tell you. You just have to insert your animation into the variable. Make sure that the animation is not corrupted and that you have a animation controller

View user profile

9 Re: Player Animation Setup, ADVANCED on Sat Jun 21, 2014 2:36 am

developer23


Moderator
Moderator
Yeah,cool,thank you Bryce! Very Happy

View user profile http://masterdevelopers.altervista.org/

10 Re: Player Animation Setup, ADVANCED on Sun Jun 22, 2014 10:28 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
servival wrote:
BryceCain25 wrote:This player animation setup is all in one, it will transition your animations nicely. It won't be choppy at all. As long as your animations aren't choppy this script will allow you to setup your player..
I did make this script, this is not anyone elses..
Instructions:
Make new JavaScript (name whatever)
Copy the code (Below)
Attach to player (has to have first person controls or third person controls.
Then assign the variables your animations
walkb: walk backwards
walkf : walk forwards
rsidestep : right side step
lsidestep : left side step
idle: idle animation
then play your game!

Code:
#pragma strict
var idle : Animation;
var lsidestep : Animation;
var rsidestep : Animation;
var walkf : Animation;
var walkb : Animation;

function Update () {
if(Input.GetKeyDown("a")) {
lsidestep.CrossFade(lsidestep.name);
}
else {
lsidestep.CrossFade(idle.name);
}
if(Input.GetKeyDown("w")) {
walkf.CrossFade(walkf.name);
}
else {
walkf.CrossFade(idle.name);
}
if(Input.GetKeyDown("s")) {
walkb.CrossFade(walkb.name);
}
else {
walkb.CrossFade(idle.name);
}
if(Input.GetKeyDown("d")) {
rsidestep.CrossFade(rsidestep.name);
}
else {
rsidestep.CrossFade(idle.name);
}
}








Please show your support by leaving a nice comment below
thanks
-BryceCain25
I've grapped the animation clips but for some reason i can't drag them into the field that requests them, can you help me gyus with that by telling me if i am missing something ?  monkey 
actually...i just found out a different way to do this...instead of a animation variable do "AnimationClip" this is used by animation.name.
Sooo sorry for screwing it up

View user profile

11 Re: Player Animation Setup, ADVANCED on Sun Jun 22, 2014 10:29 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
developer23 wrote:Yeah,cool,thank you Bryce! Very Happy
Thanks! I think it's a pretty cool setup Smile

View user profile

12 Re: Player Animation Setup, ADVANCED on Wed Jun 25, 2014 10:54 am

NXTGenerationsTv


Member [Lv. 3]
Member [Lv. 3]
wow very simple and also very good ... maybe check in the script if the player is colliding a wall and than stop the animation ... but your script does the basic job

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum