nParticle kill on collision


#2

Anything that works on old Maya particles should work just fine on nParticles.

I can’t access Maya here right now but it should work just making a new event and deselecting emit and split and selecting kill original particle.

A more fun way is to create a volume axis field and check to see whether the particles are being affected by it.

If you set your particles lifespan to lifespanPP, you will need to set the lifespan in the creation expression, you can then set the particles lifespanPP to -1 when it enters the field. When you are in the expression editor you will see under attributes ones called inputForce
[li] these correspond to the various fields affecting your particles. I believe they are numbered from 0 based on the order of which they were added to the particles.[/li]
So your expressions would look like.

Creation

lifespanPP = 3 + rand( 1 , 2 );

Before Dynamics

if (inputForce[0] > 0) 
  {
  lifespanPP = -1;
  }
  

#3

select grimreaperPlane1

nMesh > Create Passive Collider

select grimreaperPlane1 again

go into nParticles> Particles Collision Event Editor

under objects select MrnParticle1

Click on New Event

check All Collisions

make sure nothing else is checked

scroll down and Check Original particle dies

click on Create event.

scroll back up
under Events select Event1

then where it says Set event name: “put down whatever name u want and hit enter” that will change that event name so you can tell the difference between different events, if you have it.

Now everytime MrnParticle1 touches grimreaperPlane1 it will die on contact.


#4

brjig - that kills on all collisions. Sorry, I should have mentioned that I need it to die on collisions with this object specifically since I need the particles to accumulate on something else but want to kill all the other particles that are dropping out of the camera view. If it’s easier, I could kill the particles based on a distance from the emitter.

Cheesestraws - that looks like it does the same. Am I wrong?


#5

then change the collision number

instead of having all collisions checked in the event editor, uncheck it and put the number to 1.

and then in the attributes for the nParticle under COLLISION set the collision layer to 1

so that way, anything set to layer 1 will only affect eachother.


#6

And the way using a volume axis field will only affect particles if they enter the volume axis field, you could technically have them killed as they leave as well.


#7

thanks - the collision layer did it. Sorry I’m such a newb with particles. Does using collision layers also speed up another other particles that don’t need to collide with x layer?

Cheesestraws            - thanks for the volume killer but I just wanted to do the Event editor since it seemed more nParticle-ish and easy. I'll try that another time though

edit: spoke too soon. it didn’t work.


#8

I thought the collision number in the editor was the number of collisions, so 2 would mean the particle dies on the 2nd collision.

If you want the particle to die on a specific object then you add the PP attribute collisionGeometryIndex. Each collision object has its own cGI so you can kill the particle when that collison occurs whether its the first bounce or the 100 using code, not the editor.

[EDIT] I just tried it out myself and there are a couple of issues here. Firstly this work with Mayas traditional particles and collisions. However, using nParticles and nRigids, there is no access to this PP index so it doesnt work. Also if I create a nParticle then try to the make collide from the older menu this doesnt work also for obvious reasons. Now Im stuck.

This has brought up some questions for me, how many other PPs are ignored by nParticle, traceDepthPP?


#9

Bueller?

no one can kill mighty MrParticle?


#10

OMG.it really works well.
there are many times i want to kown which object does the particle collide.and i did’n find the way…now,thank you for telling me the secret.
why…why maya has hided so many useful things.
just add a pp attribute,and then it works.
should we just watch the help word by word?
my english is not that good…


#11

Aikiman, I believe only the ones listed here.

Cgbeige, what is wrong with my method then? You asked for a kill plane/volume and the method I suggested can do that.


#12

[ul]
[li]The collisionGeometryIndex output attribute is not supported for nParticles collision events in Maya 2009.[/li][li]nParticle collisions events pass the name of the Nucleus object that the nParticles are colliding with rather the geometry’s name to the event callback.[/li][li]The Nucleus ground plane cannot be the target of an nParticle collision event.[/li][li]The collision output attributes in the local space of the collision geometry are not supported in Maya 2009. This includes the following attributes: collisionForce collisionIncomingVelocity, collisionOutgoingVelocity collisionNormal, and collisionPosition.[/li][/ul]Why do they do this? This closes off so many possibilities when it comes to collisions OMFG.

BTW the input force method is a great little secret, shssh dont tell anyone.


#13

You could probably calculate each of those from monitoring and storing attributes and comparing before and after collisions. Certainly more work than it was before though.


#14

Looks like you have to resort back to using the proc call down the bottom of the collision event editor.


#15

I was able to add collisionGeomtryIndex using nParticles and nRigids but i don’t know what to do after that? Can you shed some light on this feature?


#16

yeah you can add it, but it wont be recognised by nParticles so you’re wasting your time, I tried it before, read the notes above from the help docs.


#17

hi guys,

on a similar topic, i am am trying to figure out how to make particles wait a specific amount of time after they collide with an object before they die?

i have a stream of nparticles travelling down a volume axis curve and then colliding with an object, but want them to sit on the surface for a beat before they die…

any thoughts?

cheers!


#18

Easiest way to do that is to create an event and emit new particles where the original particle collides, set inherit velocity to none and kill the original particle. This trick makes it look like you only have one particle.


#19

another way is record ur collision frame to pp attr…
and do something like this in runtime expression:

int $stay = 10;
if ((frame) == (collisionFramePP+$stay)) lifespanPP=0;

here it will stay for 10 frame after collision, u can also to randomize the $stay…
this is just what in my mind. I didn’t test it…


#20

Hi all, i’m having a similar problem, I got the plane to begin killing MrnParticle on seperate collision layers, but it seems to kill off my whole grid of particles. The scene is pretty simple, just a bunch of nParticles pushing a grid of nParticles into the wall O Death. Any help would be appreciated! :slight_smile: thx


#21

Can you upload you scene?