Could someone explain to me the code in the last two line? I’m a bit confused by it. Also is hit a gameobject because it was referenced as a variable. That is why its able to access transform?
var TheDamage : int = 50;
var Distance : float;
function Update ()
{
if(Input.GetMouseButtonDown("Fire1"))
{
var hit : RaycastHit;
if(Physics.Raycast (Transform.position, transform.TransformDirection(Vector3.foward),hit))
{
Distance = hit.distance;
hit.transform.SendMessage("ApplyDamage"), The Damage, SendMessageOptions.DontRequireReceiver;
}
}
}