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 /
This question was closed Jun 21, 2014 at 03:21 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by TheAlmightyPixel · Jun 20, 2014 at 06:39 PM · particlestagsystememitterfatal

How can I make fatal particles? (C#)

Hi, so I've come into a bit of a dead end here, I've spent a few hours working on a cannon, that has a Particle System in front of it, firing a single cannonball every second. The thing is, I'd like the cannonball to kill the player, right now they just bounce off the player. I've made a Tag for all things that are supposed to 'kill' the player, called "Fatal". Now, Could I somehow detect a collision with the particles, and kill the player, instead of having the cannonballs go absolutely crazy and fly into another universe? I've configured the game so that every object that the player collides with, and has the tag "Fatal", kills the player. Here's the tag code...

 //Death Script,  Tag Enemies and Objects with the tag "Fatal" in order for this to work!


 void OnCollisionEnter(Collision other)
 {
 if (other.transform.tag == "Fatal") 
     {  
         Die();
     }
 }    

 //In case the character should die, just write Die (); to initiate the death. 

     void Die()
 {
     Instantiate(DeathParticles, transform.position, Quaternion.identity);
     transform.position = spawn;

 }

If anyone could help me create a script that allows me to make the particles (cannonballs) "Fatal" aswell, that'd be amazing! I'm also open to suggestions on new ways of making the cannonballs kill the player. Thanks in advance!

Comment
Add comment · Show 1
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 meat5000 ♦ · Jun 20, 2014 at 07:56 PM 0
Share

You can actually use the Particle System to spawn any object you like. These objects can contain any scripts.

I used the particle system to spawn Enemy aliens that were ejected from the bottom of a moving spaceship. The enemies we fully functioning, starting in Ragdoll mode then springing in to action when they hit the floor :)

Of course, tanoshimi has the simpler answer

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Jun 20, 2014 at 07:52 PM

You need to use OnParticleCollision rather than OnCollisionEnter. http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnParticleCollision.html

Comment
Add comment · Show 1 · 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 TheAlmightyPixel · Jun 21, 2014 at 01:55 PM 0
Share

Oh, thanks a lot! I'm pretty new to Unity and C#, but this helped a lot!

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to Activate Particle System? 0 Answers

Particle system not working. 1 Answer

how to turn on an emitter with another emitter? 1 Answer

ARK of the COVENANT | How do I trigger Particles to come out once the top has been removed? 0 Answers

Particle system won't stick to player after shoot 0 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