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
0
Question by GesterX · Apr 25, 2011 at 03:30 PM · onparticlecollision

Why isn't my OnParticleCollision working?

I have a large particle system ("Soul") which I want to detect collisions. I have some other particle systems called "Demons" which travel towards the "Soul". If the demons collide with the soul then they should be destroyed and make the soul do some iTween stuff.

My OnParticleCollision in a script attached to the soul looks like this:

function OnParticleCollision (other : GameObject) {
    print("abc");
    if(other.tag == "Demon")
    {
        iTween.ColorTo(gameObject, Color.red, 0.2);
        iTween.ColorFrom(gameObject, Color.red, 0.2);
        Destroy(other);
    }
}

However I cannot even get the method to Print "abc". Both the soul and demons have world particle colliders. The soul has the "Send Collision Message" box ticked. All objects are tagged correctly.

I have tried adding colliders to both objects but with no luck...

Any ideas as to why this won't work??

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

6 Replies

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

Answer by equalsequals · Apr 27, 2011 at 06:11 PM

Unity does not support particle-to-particle collision. The calculations and SendMessage overhead would be such a performance killer that you wouldn't want to do it anyway, even if you could.

With that said what you could do is use a general collider that is the general shape of your character, this could be a capsule for an oblong shape, or sphere if you aren't adding any directional velocities to your ellipsoid emitter (assuming you are using one and not a mesh emitter).

This will be far more efficient and if done right, you likely won't be able to tell the difference.

Hope that helps.

==

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 GesterX · Apr 27, 2011 at 06:54 PM 0
Share

I didn't realise this and thinking about it that would be a lot to calculate. I've simply added an empty gameobject with a collider around the player and it all works fine. Thanks for the answer.

avatar image
1

Answer by AngryOldMan · Apr 27, 2011 at 06:20 PM

use the gameobject that the particles are attached to in order to detect collisions. Assuming your player isnt just a single particle floating about which you can some how control? A little more about how your game is set up would be useful if possible, like equalsequals says unity cant detect particle to particle collisions so you are going to have to use a work around to get the same effect but using different methods, if you tell us how it is set up we can tell you possible work arounds :)

Comment
Add comment · 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
0

Answer by xCRKx TyPHooN · Apr 25, 2011 at 04:37 PM

I haven't messed with particles myself, but here is a link to Unity's documentation that should help. Be sure to read the paragraph above the code that describes exactly what you need in order for the collision to register.

Particle Collision

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 GesterX · Apr 25, 2011 at 05:56 PM 0
Share

Hi, I read this prior to posting and am already acquanted with the set up.

avatar image
0

Answer by Ben Holmes · Apr 27, 2011 at 05:55 PM

If you re-read the paragraph the other user linked to you it says that OnParticleCollision is called when a particle hits a collider. This means that the object you want to be able to collide with needs to have a collider on it. I don't believe Unity's particle system allows single particles to have their own colliders so it seems that getting collisions between particles in this way doesn't work.

Comment
Add comment · Show 2 · 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 Chris D · Apr 27, 2011 at 06:08 PM 0
Share

GesterX did mention that he'd tried attaching colliders to his objects without any luck. Perhaps if there was something amiss with how he went about doing it?

avatar image Ben Holmes · Apr 27, 2011 at 06:24 PM 0
Share

adding a collider to the particle emitter gameobject doesn't help because the particles which are emitted still don't have colliders (and can't).

avatar image
0

Answer by CarlLydon · Apr 17, 2014 at 12:44 AM

You can always code your own particle system using meshes with colliders on them. Particles are pretty fun and easy to program so maybe that would work for you?

Comment
Add comment · 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
  • 1
  • 2
  • ›

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

2 People are following this question.

avatar image avatar image

Related Questions

Collide with Non-Moving Particle 0 Answers

Why can't I add non-prefab colliders to a particle effects triggers list? 0 Answers

OnParticleCollision only working for some objects and some particle emitters 2 Answers

Collision on zero-velocity particle 1 Answer

Position of an individual particle 1 Answer


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