- Home /
How to create particles once an object has collided with another
Hi everyone, i'm kinda new to scripting and have a lot of trouble with it, but I am trying to make water particles appear once a tree has hit water. If there is a way to do this without scripting that would be nice but if not I prefer to use javascript (as I have a little understanding on how to use it.)
Any help would be nice thanks :)
Answer by Ekta-Mehta-D · Oct 04, 2013 at 07:05 AM
Its very simple to do. Here is a code to create particles :
function OnCollisionEnter(collision : Collision)// you can use OnTriggerEnter() also..Depends up on how you want to detect collision
{
if(collision.gameObject.tag == "zombie")
{
Instantiate( bloodPrefab , collision.contacts[0].point, bloodPrefab.transform.rotation );
Destroy(gameObject);
}
}
but for this you need to create particle system and then you will create prefab of it.. I want to make blood drops so i have "bloodPrefab"..
For water particle you can go through this link :
http://forum.unity3d.com/threads/48706-How-to-build-water-bubbles-particle-system
If you find my answer useful then please do check mark.. Thanks..
Your answer
Follow this Question
Related Questions
Why does my player moves to the top of his capsule collider? 1 Answer
Error Help (You can only call GUI functions from inside OnGUI.) 0 Answers
When Does the frameCount Goes to zero? 2 Answers
Convert Input Field to String 0 Answers
How do I apply UnityPro Water to a basic shape without render distortion? 0 Answers