How to deal with enemy/player health?

I am a beginner to unity3D. I am trying to develop a first person shooting game.
Things I am using:

  1. Monster Base Team Asset
  2. Angelic Sword Asset

I have made a EnemyAI script that is assigned on monster. It says as the player arrives close, run to the player and if distance is too close(about 1 meter) just stop and play attack animation.

PROBLEM: I want that when weapon(an ax or hammer) touches any part of players body or sword, players health should go down. Further if sword of player touches the body of monster or its ax(or hammer), its health should go down.

I am using this code to let monster follow player and keep it on terrain
var pos : Vector3;

 pos = transform.position;
 var x : float = transform.localScale.y/4;
 transform.position = new   Vector3(pos.x,Terrain.activeTerrain.SampleHeight(pos)+(x),pos.z);
	transform.Translate(Vector3.forward * speed * Time.deltaTime);

I cannot make monster as “Rigid Body” as when I do that it just fall from terrain. Please help me I am really stuck. Thanks in advance. Please write code if possible.


well why wouldn’t you make the gravity = 0 changing Physics.gravity

then the rigidbody wouldn’t fall down and you could use OnCollisionEnter

you might wanna try using OnCollisionEnter

 function OnCollisionEnter (other:Collision)
        if ( == "urobjectname") //urobjectname is the gameobject you are colliding with
           Debug.Log("Hit!"); //set ur condition here ie, dropping health or so