hello,i was making a zombie game and I’m have two problems when i shoot my gun and it has to do with the bullet holes.I have been search all over for help and couldn’t find it every time i shoot my gun in the air the bullet holes get stuck in mid air and when i shoot a zombie the bullet holes show on the zombie how would i make to were the bullet holes don’t get stuck in mid air on get stuck on the zombie when i shoot.Now the bullet hole is a BlendedDecal and i am so confuse on how to fix the problem i don’t even know where to start would i need to write a script or something well here’s my shooting script
using UnityEngine;
using System.Collections;
public class shoot2 : MonoBehaviour {
public GameObject bullet;
public GameObject bulletHole;
public float delayTime = 0.5f;
private float counter = 0;
void FixedUpdate ()
{
if(Input.GetKey(KeyCode.Mouse0) && Time.time >= counter)
{
Instantiate(bullet, transform.position, transform.rotation);
audio.Play();
counter = Time.time + delayTime;
RaycastHit hit;
Ray ray = new Ray(transform.position, transform.forward);
if(Physics.Raycast(ray, out hit, 100f))
{
Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
}
}
}
}