This is my Racast shooting script
the script:-
public float damage = 10f;
public float range = 100f;
public Camera fpscam;
public Text hitText;
public ParticleSystem particle;
private void Update() {
if(Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
void Shoot()
{
particle.Play();
RaycastHit hit;
if(Physics.Raycast(fpscam.transform.position,fpscam.transform.forward, out hit,range))
{
hitText.text = hit.transform.name;
}
}
This comment has been removed by the author.
ReplyDelete