Hi im using Tornado Twins’ YouTube series on how to make a turret shoot at me using this script:
var LookAtTarget : Transform;
var damp : float = 6.0;
var bullitPrefab : Transform;
var shotTime: float = 0;
var shotInterval: float = 2;
var speed : float = 1000.0;
function Update ()
{
if(LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
if (Time.time > shotTime){
Shoot();
shotTime = Time.time + shotInterval;
}
}
}
function Shoot()
{
var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint").transform.position, Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * speed);
}
and it works great but i want when the bullet hits me, for it to hurt me, or say if 5 bullets hit me, i respawn. Any idea how to do this? Thanks so much!
i had trouble adding tags too.
the problem is that the text field is the same color as the background of the tag manager
when you open the tag manager you have two columns
the number and the tag name.
place your mouse over the word water in the second column and move down until it is in line with user layer 8 in the first column if you there you will be able to type in a text field and make your own layer.