Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by inveni0 · Jan 27, 2010 at 06:06 PM · collisioniphoneparticles

Detecting Particle Collisions

Is it possible to detect where a stream of particles is colliding? I don't need the particles to bounce or anything crazy like that. I just need to know if it's intersecting a mesh. Is that within the range of Unity's capabilities?

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

3 Replies

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

Answer by sulas · Jan 27, 2010 at 07:31 PM

I haven't tried this pefore, but thought of doing something like that for a flamethrower. Check this out, it might help:

http://unity3d.com/support/documentation/Components/class-WorldParticleCollider.html

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
1

Answer by Ashkan_gc · Jan 27, 2010 at 08:20 PM

there is a component called particle collider that you can use to make particles lose energy or bounce or ... when colliding with other particles. there is a check box (bool value) in this component called SendCollisionMessage that if you check it a OnParticleCollision event will be called in all scripts attached to the GameObject containing the particle collider and the GameObject that particles collided with. so you can use this function in your mesh object and do what you want when particles collide with you. as you can see in the sample of documentation you can see the object that you collide with in the passed argument.

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 inveni0 · Jan 28, 2010 at 04:08 AM 0
Share

I should add that I'll be developing on iPhone. The goal is to have a narrow stream of water. Would message sending incur too high a load on the iPhone platform?

avatar image Ashkan_gc · Jan 28, 2010 at 05:23 AM 0
Share

you can test it for yourself. it's depending on many factors. try to keep the code inside message lightweight and you'll be good to go. i don't have any experience in iphone development.

avatar image
0

Answer by AD110 · Jan 17, 2017 at 02:43 PM

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

public class Example : MonoBehaviour

{

 public ParticleSystem.Particle[] ParticleList;

 private ParticleSystem m_particleSystem;

 private GameObject character;
 int Score = 0;

 void Start()

 {
     character = GameObject.FindGameObjectWithTag ("Iz");
     m_particleSystem = GetComponent<ParticleSystem> ();
 }

 void LateUpdate ()
 {
     //This list will be used to store each particle that is alive 
     ParticleList = new ParticleSystem.Particle[m_particleSystem.particleCount];

     //storing particles into a list
     m_particleSystem.GetParticles (ParticleList);

     // Change only the particles that are alive
     for (int z = 0; z < GetComponent<ParticleSystem> ().particleCount; z++) 
     {    
         //getting the position of the player and the particle
         Vector3 dis = ParticleList [z].position - character.transform.position;

         //if it is near
         if(dis.magnitude <= 5)
         {
             //destroy the particle
             ParticleList [z].lifetime = 0;
             //add score
             Score++;
         }
     }

     // Apply the particle changes to the particle system
     m_particleSystem.SetParticles (ParticleList, m_particleSystem.particleCount);
 }

}

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

1 Person is following this question.

avatar image

Related Questions

Inconsistent Particle Collision detection 0 Answers

Particles collision Stopped working after a while 0 Answers

Why is ParticleCollider's intersection always zero? 1 Answer

HELP!! OnCollisionEnter is not working when i built it out on IPHONE! 0 Answers

Why do my first few collectable/powerup collisions cause lag but not later ones? 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