Hi all,
i have a problem.
i have my fps controller, with this script attached:
var moveDirection:Vector3;
function Update () {
moveDirection = new Vector3(-Input.GetAxis("Vertical"), 0,
``Input.GetAxis("Horizontal"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= 50;
GetComponent(CharacterController).Move(moveDirection*Time.deltaTime);
}
and i have an enemy with this script:
function OnControllerColliderHit (hit : ControllerColliderHit) {
print("OnControllerColliderHit with: " + hit.collider.gameObject.name);
if(hit.collider.gameObject.name == "Hero"){
print("Entrato Collision Hero");
animation.CrossFade("fight");
}
}
It doesn’t work and i don’t understand where is the problem; i used the move function, but OnControllerColliderHit doesn’t detect the collisions with my hero…someone can help me?
Thanks