FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Player Animation Setup, ADVANCED

Share

pollIs this a good script?

Yes! Its fantastic and my animations are smooth
7
88%
NO! I hate this script, the animations are choppy (or other reasons)
1
12%
Total Votes:
8

descriptionPlayer Animation Setup, ADVANCED

more_horiz
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

descriptionwould this script interfere with motor ?

more_horiz
bump

descriptionRe: Player Animation Setup, ADVANCED

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

_________________
-BryceCain25

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
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);

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
[You must be registered and logged in to see this link.] 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

_________________
-BryceCain25

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
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 

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
[You must be registered and logged in to see this link.] 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 

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
servival wrote:
[You must be registered and logged in to see this link.] 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

_________________
-BryceCain25

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
Yeah,cool,thank you Bryce! Very Happy

_________________
Game Developer
YouTube Channel: [You must be registered and logged in to see this link.]
Website: [You must be registered and logged in to see this link.]

descriptionRe: Player Animation Setup, ADVANCED

more_horiz
servival wrote:
[You must be registered and logged in to see this link.] 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

_________________
-BryceCain25
Permissions in this forum:
You cannot reply to topics in this forum