Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by remvan3d · Jul 09, 2010 at 08:17 AM · triggerparticleseffectbox

How to trigger a particle effect?

Hello.

I have just recently started my internship for a small indy developer in Norway, and have been given the task of creating a prototype level for a future project. My experience is visual level design, and close to no scripting what so ever. I'm a major noob with scripting.

I need to figure out how to activate a particle effect with a contact/collision trigger. To be more precise, activate a water splash after hitting the water with the character. Anyone who can give me a hint on how to set up the script? Preferably in C#, but JS could also work since it's only a prototype project.

-Noob intern-

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by spinaljack · Jul 09, 2010 at 09:33 AM

what you can do is place a trigger collider on the water (mesh of box) and instantiate a splash prefab (one shot particle emitter) at the point of contact. Also if the water is perfectly level like in a small lake you can set the exact height of the water, otherwise you'll need to use a raycast to fine the surface point e.g.

var splashPrefab : GameObject; var splashPoint : Vector3; var waterHeight : float = 2.0; // the height of the water if it doesn't move

 function OnTriggerEnter(other : Collider){
    if(other.gameObject.CompareTag("player")){
       splashPoint=other.transform.position;
       splashPoint.y = waterHeight;
       Instantiate(splashPrefab,splashPoint,other.transform.rotation);
    }
 }

You can also do a 2nd splash which is smaller and use it with OnTriggerStay so it plays while the player stands in the water as well.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image smirlianos · Jan 04, 2013 at 07:00 PM 0
Share

This helped me too! But when the player leaves the water, the splash effect continues to appear...

avatar image crusherxman · Jul 19, 2013 at 03:41 PM 0
Share

Nice one, but why does the particle effect repeats all the time when I'm out of the water? :\

avatar image TheGeekyDead · Nov 28, 2013 at 06:59 PM 0
Share

I was looking for something similar for my project, but not swim$$anonymous$$g just falling into knee deep flooded basement.

It works great after i merge it into my current script thanks man +Rep

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to trigger an effect when an object is under a shadow? 0 Answers

Get all particles within trigger collider? 1 Answer

How to GetComponent from another Gameobject OnTriggerEnter 1 Answer

network effects 1 Answer

Emit Particle upon Death 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges