- Home /
Question by
ThePanJake · Jun 09, 2019 at 10:13 PM ·
script.
Bullet exploding problem on short distance,Bullet Explode problem on short distances
If i shoot and the bullet hits on long distance it explode as soon as it touches the terrain, but within 3-4 meters around the player it explodes after a while
This is on long range
And this on short range
using UnityEngine;
public class bulletExploding : MonoBehaviour
{
public GameObject explosionEffect;
private void OnTriggerEnter(Collider other)
{
Explode();
}
void Explode()
{
Destroy(gameObject);
GameObject explEff = Instantiate(explosionEffect, transform.position, transform.rotation);
Destroy(explEff, 2f);
}
}
desktop-screenshot-20190609-15200963.png
(436.8 kB)
desktop-screenshot-20190609-15205365.png
(473.3 kB)
Comment
Your answer