- Home /
Position of an individual particle
I would like to get the position of a particle for use in the OnParticleCollision function. I'm trying to create a fountain and I would like to instantiate an object every time a particle hits the ground. My code so far is this:
function OnParticleCollision(other:GameObject)
{
if (other.CompareTag("Floor") )
{
var direction:Vector3 = other.transform.position - transform.position;
var go = Instantiate(bloodSplatter, direction, Quaternion.identity);
}
}
Right now direction returns as the particle emitter's position. But I would like to get the position of the specific particle that collided with the floor. I'm guessing it would have something to do with looping through the particles[] array, but I'm not sure. Any help would be greatly appreciated. Thanks!
Answer by Jesper Mortensen · Mar 08, 2013 at 07:32 AM
We are currently adding collision messaging to Shuriken, this will allow the user to receive callbacks when particles collide with objects and allow the user to pull per particle collision data such as impact point, incident velocity etc.
We are actively working on the collision messaging ATM and with any luck it should go into Unity 4.2 slated for end of April.
Your answer
Follow this Question
Related Questions
Shuriken and OnCollisionParticle 1 Answer
World Particle Collider - Not Working 1 Answer
Register Particles going through Trigger collider 1 Answer
Water emission using c# 1 Answer
Problem with changing color of particles 3 Answers