- Home /
How to make blood splatter using projectors(or decals)
I have been spending days trying to find the proper way to do this, i simply want to spawn a projector that displays a blood splat when a particle hits the ground or a wall. I can make the projector spawn on the particle collision but it spawns hundreds of them. Here is what I have now:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class splatter : MonoBehaviour {
public ParticleSystem particleHit;
public GameObject splat;
public List<ParticleCollisionEvent> collisionEvents;
void Start()
{
particleHit = GetComponent<ParticleSystem>();
collisionEvents = new List<ParticleCollisionEvent>();
}
void OnParticleCollision(GameObject other)
{
Debug.Log("particle HIt");
int numCollisionEvents = particleHit.GetCollisionEvents(other, collisionEvents);
int i = 0;
while (i < numCollisionEvents)
{
GameObject BloodSplat = Instantiate (splat, collisionEvents[i].intersection, Quaternion.Euler(90,0,0));
i++;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Blood patterns on terrain 0 Answers
Bloodstream flow 0 Answers
Recolor Grass 0 Answers
Make blood on ground 0 Answers