- Home /
Bullet Splatter!
I am making a 3dFPS game and can't figure out how to make a bullet splatter on an object after the bullet hits it? Here is my bullet code using System; using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Bullet : MonoBehaviour
{
//Config param
[SerializeField] private AudioClip[] clips;
[SerializeField] private int bulletMaxTime;
[SerializeField] private GameObject particle;
private int timeSinceBulletSpawned;
// Start is called before the first frame update
void Start()
{
PlayFiringSFX();
Destroy(gameObject, bulletMaxTime);
}
private void PlayFiringSFX()
{
//Reproduce el sonido en donde sea el inicio de la bala
AudioSource.PlayClipAtPoint(clips[0], transform.position);
}
private void PlayHitSFX()
{
AudioSource.PlayClipAtPoint(clips[1], transform.position);
}
private void OnTriggerEnter(Collider other)
{
PlayHitSFX();
//ParticlesHit();
Destroy(gameObject);
Debug.Log("Collision");
}
/* private void ParticlesHit()
{
Instantiate(particle, transform.position, Quaternion.identity);
Destroy(particle,3.0f);
}
*/
}
Answer by Llama_w_2Ls · Jan 13, 2021 at 12:07 PM
The issue with bullet splatters and bullet holes is that on solid, square-faced objects (E.g. walls), this effect is quite easy to achieve. You can instantiate a particle system or texture onto the hit.point of where your raycast hits, or where your bullet collided with. However, with characters like players who have round figures, the texture needs to wrap round the object. This can be done using the Decal system, provided by Unity. Try this tutorial: Decals in Unity for more information. @WillthePro
Your answer
![](https://koobas.hobune.stream/wayback/20220613023220im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Achieving Bullet Holes 1 Answer
SetPixels too slow 2 Answers
How do I make bullet marks? 1 Answer
Bullet Collision 1 Answer
Bullet Mark Texturing offset too far 1 Answer