- Home /
This post has been wikified, any user with enough reputation can edit it.
animation does not WORK!! part 2
the animation(first one) is supposed to work but it doesnt!
i set my wrapmode to only fire once, it didn't work. i deleted the overlapping animation, it didn't work either.
pls help!
#pragma strict
var thedamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
public var TheHammer : Transform;
function Update ()
{ if (Input.GetButtonDown("Fire1"));
{
TheHammer.animation["attack"].wrapMode = WrapMode.Once;
TheHammer.animation.Play("attack");
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", thedamage, SendMessageOptions.DontRequireReceiver);
}
}
}
if (TheHammer.animation.isPlaying == false)
{
TheHammer.animation.CrossFade("HammerIdle");
}
}
Comment
the animation is supposed to play whenever left mouse button is pressed.
Your answer
Follow this Question
Related Questions
unexpected token: ApplyDamage 1 Answer
NullReferenceException: Object reference not set to an instance of an object 1 Answer
animation doesn't work??? 1 Answer
Animation not working? 0 Answers