How would I go about getting the mesh filter of a particle collision and than assign that mesh to the particle.
So I have a OnParticleCollision. I hit the object take this object I get its Mesh Filter. I than want to assign this to that of my particle so it takes the effect of its physical build.
Here is my code so far.
void Start()
{
Debug.Log("Script Starting...");
part = GetComponent<ParticleSystem>();
collisionEvents = new List<ParticleCollisionEvent>();
}
void OnParticleCollision(GameObject coll)
{
// Getting the object of the collider
Collider obj = coll.GetComponent<Collider>();
Mesh mesh = obj.GetComponent<MeshFilter>().mesh;
// Assign the mesh shape of the collider to that of the particle
ElectricWave.shape.meshRenderer = mesh; // I know this doesnt work as is.
// Play effect
ElectricWave.Play();
}