- Home /
Is it possible to make a particle system solid???
Is it possible to make particles of a Particle System solid? In the game I am working with, there is a wall of bricks. When the left mouse button is clicked, a ball is fired at the wall, and the wall breaks. I want to make the 'F4' shoot a black Particle System at the wall. I made an attempt, but the particles pass through the wall. Nothing is wrong with the wall. I applied Rigidbody to the particle system, and I have Use Gravity checked, and Is Kinematic is off. Interpolate = none, and Collision Detection = Discrete. Why won't the particles knock down the wall??? Here is the C# script I wrote:
void Update () {
if (Input.GetKey(KeyCode.F4))
{
Rigidbody instance = Instantiate (ParticleSystem, transform.position, transform.rotation) as Rigidbody;
Vector3 fwd = transform.TransformDirection (Vector3.forward);
instance.AddForce (fwd*power);
}
}
Please Help!!!
Which particle system are you using. Both of them have some form of world collision
A particle system simply generates particles. It in itself only emits them. It is not the particles themselves. You therefore cannot add a Rigidbody
component to particles. Only to a particle emitter.
Sage logic, and thanks for it! However, I already did the following: I applied the Rigidbody component to the Particle System and gave it a Sphere Collider. This was good enough for my purposes (it appeared in the wall, blowing it apart). Thanks anyways, though!
Answer by EvoGames · Jul 21, 2013 at 06:31 AM
You could make a sphere gameobject the parent of the emitter and disable the mesh renderer of the sphere. Then you can add the rigidbody component, or any scripts you need, to the sphere. The sphere will control the physics and it will not be visable.
Hope this helps!!!
...wouldn't this only add a collider to the emitter, not the particles themselves?
Correct, EvoGames. As I have written in the the previous comment, I did just that. It was not a solution to my question but it still worked well enough for my purpose.
Answer by You! · Jul 20, 2013 at 11:37 PM
Absolutely - particles can have collisions. The new (Shuriken) particle system can do this by checking "Collision" from the list and editing the Collision values. The Legacy particle system requires the "World Particle Collider" to achieve the same results. (The legacy component is positioned with the rest of the legacy particle components in Unity's drop-down top menu.)
But this doesnt work if you have that brick wall on trigger. Does taht mean thses particles dont have a rigidbody class attached to them :/ . But the trigger on the particle system module works.