- Home /
This question was
closed Apr 17, 2014 at 09:49 PM by
getyour411 for the following reason:
Duplicate Question
Question by
joshmann971 · Apr 17, 2014 at 09:42 PM ·
raycastenemyhealth
Raycasting help, enemy damage
Hello again, i have a question about raycasting and enemy damage. Here is my script.what i want to happen is if i shoot a raycast at an object tagged "Enemy" then health is taken away.
var health = 150
var target : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var myTransform : Transform;
function Awake()
{
myTransform = transform;
}
function Start()
{
health = 150;
target = GameObject.FindWithTag("Player").transform;
}
function Update(){
transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z));
myTransform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
if( // stuff here
Comment
Follow this Question
Related Questions
Raycast Shoot Error 1 Answer
Enemy Health With Raycast Not Working 1 Answer
Making bullet holes in enemies. 1 Answer
Enemy health. Need to take damage from two different bullet prefabs 1 Answer