I am trying to make my character animate on touch or Click. Is this possible with this code??? I am attaching this script to the Character.
#pragma strict
var targethit : GameObject;
function Update()
{
checkForHit();
}
function checkForHit()
{
var ray = Camera.current.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 200))
{
var objecthit:Transform = hit.transform as Transform;
if (hit.collider.name == targethit)
{
animation.Play("hurt-front");
}
}
}