Shuriken Particle System + Collision = Bug ?

Hi all…
I’m building an explosion and the wreckage fly around… the problem is: I am trying to make the wreckage do damage if hit something…
So… I enable Collision on Shuriken Particle System. But this doesn’t work!!! Here what i’m using:

  • Unity Last version
  • 2D project

I try to follow some resources that i find, but unsuccessful:
Recent post of a guy with same problem.

any thoughts?
Best regards,
PJRM - Plínio J.

I dont think it collides with sprites (2D colliders)…?

There is nothing about it on doc. So I imagine it should be ok for both.

seems like missing that feature still,
http://forum.unity3d.com/threads/210556-2D-Physics-Particle-Systems-Collision

Thank you so much.

Hope next update we have shuriken particles working with 2D colliders and emission on X and Y since 2D use only those, we don’t need it to cast particles on Z.

you could kind of fake it for now,
by adding box/mesh collider as parent for the sprite… then sendmessage from that…

Cool. I’ll try it. but my only problem is the Z emission. Is there any way to make the particles cast always with position of Z = 0 ? Then it would collide. I’m using Birth emission to simulate the smoke of the wreckage.

On Legacy this situation is fixed using X and Y velocity direction greater than 0 and letting Z with 0. but i wouldn’t have birth emission.

^ Meant to say, set the extra collider as child, then its easier to keep it moving with sprite.

You can set X, Y, Z speeds with [×] Velocity over lifetime (and set Start Speed = 0)
And using Shape, Box: size 0,0,0

Does that work?

Sorry that i post this late. I got my own pc now.
And yeah it work!!!

Now i really dont know how to attach an child Collider to the sprite and make it in the material on my particle. May i ask you an example?

some ideas,

To set as child:

  • GameObject / Create empty
  • Set position to: 0,0,0
  • Then in hierarchy window drag drop this empty game object over your sprite object (in hierarchy list), now its child of your sprite
  • Then add collider to that empty game object: Component / Physics / Sphere collider (adjust its size if needed)

then in particle system you have

  • [×] Collision, and from dropdown under it: “world”
  • and [×] Send collision message

then can make script attach it to that empty game object:

using UnityEngine;
using System.Collections;
public class GetHit : MonoBehaviour 
{
	void OnParticleCollision() 
	{
		// send message to parent of this object, call function "WeGotHit"
		transform.parent.SendMessage("WeGotHit",SendMessageOptions.DontRequireReceiver);
	}
}

then in the parent object (your sprite) put script to it, sendmessage calls this function there:

using UnityEngine;
using System.Collections;
public class YourScript : MonoBehaviour 
{
	void WeGotHit()
	{
		Debug.Log ("we got hit");
	}
}

My friend, when i drop a sprite in the scene, it becomes a GameObject (no more sprite) so this object will not be visible in the particle system. May I ask you more detail on this?

Yes under that your (sprite) gameobject, you put the other (empty) gameobject, which then has a (3D) collider.

so in the hierarchy it looks like:

yourgameobject (parent)
-------- empty gameobject (child)

parenting tutorial:
http://unity3d.com/learn/tutorials/modules/beginner/editor/the-hierarchy-and-parent-child-relationships

Parenting pierce of cake, but use this GameObject prefab in the particle system is not possible! the reference of the sprite used in particle differs from the GameObject with parent collider.
Maybe I’m not being clear enought, although I’ve had try everyone to make the particles collide with anythink.

Great tip. I’m gonna try this out later!