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 SmartCarrion · Aug 07, 2013 at 09:21 AM · collisionparticle

What kind of datatype is a CollisionEvent?

On this page in the manual, it says to pass a data type "CollisionEvent[]" to ParticleSystem.GetCollisionEvents, but since that isn't a real data type, what am i supposed to pass? An array of "Collision" is throwing me error "CS1502 ...some invalid arguments"

Thanks! Here is the code i'm working on:

 private Collision[] collisions;
 void OnParticleCollision (GameObject particle){
 //count the collisions
     collisions = new Collision[particle.particleSystem.safeCollisionEventSize];
     temperature += particle.particleSystem.GetCollisionEvents(gameObject,collisions) / 10 * heatingRate;
 }
     


Comment
Add comment · Show 2
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 Jamora · Aug 07, 2013 at 09:52 AM 0
Share

What version of Unity are you using?

avatar image SmartCarrion · Aug 07, 2013 at 05:55 PM 0
Share

latest Pro...4.2

2 Replies

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

Answer by SmartCarrion · Aug 07, 2013 at 09:51 AM

I found the answer, I needed to refer to it as a ParticleSystem.CollisionEvent[] not just a CollisionEvent[] or Collision[].

Thanks!

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 andrew-lukasik · Oct 12, 2013 at 05:12 PM 0
Share

Thanks! That was very helpful.

avatar image
1

Answer by andrew-lukasik · Oct 12, 2013 at 10:41 PM

I just lost few hours to make this little thing work so I presume somebody would find this simple code useful around this topic:

 void OnParticleCollision (GameObject other) {
     ParticleSystem.CollisionEvent[] collisionEvents = new ParticleSystem.CollisionEvent[particleSystemComponent.safeCollisionEventSize];
     particleSystemComponent.GetCollisionEvents (other,collisionEvents);
     foreach (ParticleSystem.CollisionEvent item in collisionEvents) {
         GameObject hitmark = Instantiate (fx_Hit, item.intersection, Quaternion.identity) as GameObject;
         if (other.rigidbody) hitmark.transform.parent = other.transform;
     }
 }

In my case the problem was that item.intersection kept giving me vec3(0,0,0) because as first parameter of particleSystemComponent.GetCollisionEvents(other,collisionEvents) I placed "gameObject" not "other". It confuses me a bit still.

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

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

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Emitting Particles on Collision 0 Answers

Emit Particle when the parent gets collision 2 Answers

How to access particle collision locations 2 Answers

Using Particles with Collision 2 Answers

Locking particle axis? 3 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