I made a model on Blender with a few animations such as running, jumping, standing and punching. I want to know how to make a movement script and jumping script and a punching script. After that how would I assign each animation to its script. Thanks
Look into these resourses:
public var Idle : String;
public var Walking : String;
public var Walking_Back : String;
public var Side_Walk_left : String;
public var Side_Walk_right : String;
function Update () {
if (Input.GetAxis("Vertical") > 0)
animation.Blend(Walking);
else
animation.CrossFade(Idle);
if (Input.GetAxis("Vertical") < 0)
animation.Blend(Walking_Back);
if (Input.GetAxis("Horizontal") < 0)
animation.Blend(Side_Walk_left);
if (Input.GetAxis("Horizontal") > 0)
animation.Blend(Side_Walk_right);
}
That should work for movement just make sure you object has an animation component attached with all animations in it
then type the animations you want to use onto this component
for punching and outer things just add public
var Punch : String; //(Place start to of script)
if (Input.GetButton(“Fire1”) > 0)
animation.Blend(Punch); //(Place end to of the script just before the last } )
Let me know if you have any problems