- Home /
How to prevent particle system from running through terrain?
For the project I am working on I am interested in having a particle system, which is supposed to be representative of water, fall from the sky and run along my terrain. The issue I am having is that once my particle system makes contact with my terrain, it lingers momentarily and then falls through the landscape. I am wondering if anyone has a suggestion as to how I can make my particle system interact with my landscape?
Just wondering if you managed to figure this one out? I'm having the same issue with particles I want to land and come to rest on terrain. The particleS that hit any slope seem to drop off right away.
Having a high dampen value and low bounce seemed to help them stick more. And for you water a low dampen and low bounce looked to have a slide effect, hope that helps
Answer by hmoulais · Feb 21, 2014 at 08:38 AM
I discovered that with the new version of Unity 3D particle systems only interact with planes. When I imbedded a plane within my terrain, this prevented the particles from falling through the landscape, however the way in which the particle system interacted with the landscape was unrealistic (they more or less floated about the terrain). Therefore, I didn't use the particle system at all but derived a script instead which instructed a multitude of small spheres to fall from the sky and change colour upon interacting with a specific object on my landscape.
This is actually exactly my issue. I was hoping to use the particle system to demonstrate the movement of water over a landscape but the particles were hitting it and falling through. Can you share how you went about implementing the sphere solution? I'm quite new to Unity. Cheers, Jeremy
This is part of the code that I wrote to accomplish this:
public GameObject prefab;
public GameObject prefab_rare;
public int waitTime = 15;
private bool spawn = false;
void Start()
{
StartCoroutine(spawn_time());
}
IEnumerator spawn_time()
{
while (spawn == false)
{
spawn = true;
yield return new WaitForSeconds(waitTime);
Instantiate(prefab, new Vector3(transform.position.x, transform.position.y + 3, transform.position.z), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x, transform.position.y + 3, transform.position.z + 2), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x, transform.position.y + 3, transform.position.z + 4), Quaternion.identity);
Instantiate(prefab_rare, new Vector3(transform.position.x, transform.position.y + 3, transform.position.z + 6), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x, transform.position.y + 3, transform.position.z + 8), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 2, transform.position.y + 3, transform.position.z), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 2, transform.position.y + 3, transform.position.z + 2), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 2, transform.position.y + 3, transform.position.z + 4), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 2, transform.position.y + 3, transform.position.z + 6), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 2, transform.position.y + 3, transform.position.z + 8), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 4, transform.position.y + 3, transform.position.z), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 4, transform.position.y + 3, transform.position.z + 2), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 4, transform.position.y + 3, transform.position.z + 4), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 4, transform.position.y + 3, transform.position.z + 6), Quaternion.identity);
Instantiate(prefab, new Vector3(transform.position.x + 4, transform.position.y + 3, transform.position.z + 8), Quaternion.identity);
spawn = false;
}
This code creates many prefabs relative to the GameObject.
BTW the way you can add the World Particle Collider to the game object to make the particle system collide with anything.
Your answer
![](https://koobas.hobune.stream/wayback/20220613123132im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I make instantiated particles inherit Transform movement from their parent object? 1 Answer
Shuriken particle System - change velocity by trigger 0 Answers
Particles in world simulationSpace follow parent transforms Z position 0 Answers
How to make an effect in a particle system so that it is always behind the sphere? 1 Answer