I am a beginner to unity3D. I am trying to develop a first person shooting game.
Things I am using:
- Monster Base Team Asset
- 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.