Hi everyone im having this weird problem in Unity? Can anyone explain me why the hell this is happening? The title says it all!
Pictures
Here is my code!
#pragma strict
public var theAnimator : Animator;
var Character : Transform;
var MaxHitDistance : float = 1.5;
var RayCenter : Transform;
var Distance : float;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
theAnimator.SetBool("Hit01", true);
}
else
{
theAnimator.SetBool("Hit01", false);
}
}
function Mine ()
{
var Hit : RaycastHit;
if (Physics.Raycast(RayCenter.transform.position, RayCenter.transform.TransformDirection(Vector3.forward), Hit))
{
Distance = Hit.distance;
if (Distance <= MaxHitDistance)
{
Hit.transform.SendMessage("Mining", Character, SendMessageOptions.DontRequireReceiver);
}
}
}