View Full Version : nParticle kill on collision
cgbeige 08-08-2009, 07:17 PM I'm trying to create a Realflow-style kill volume/plane but it seems like the old non-nParticle setups don't work. I'm trying to figure out the Collision Events things but the docs don't make it clear how you can just tell it to die on collision.
So I have nParticle1 - how does Mr nParticle1 go about dying when he meets grimreaperplane1?
|
|
Cheesestraws
08-08-2009, 07:33 PM
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
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.
So your expressions would look like.
Creation
lifespanPP = 3 + rand( 1 , 2 );
Before Dynamics
if (inputForce[0] > 0)
{
lifespanPP = -1;
}
brjig
08-08-2009, 07:47 PM
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.
cgbeige
08-09-2009, 12:59 AM
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?
brjig
08-09-2009, 03:53 AM
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.
Cheesestraws
08-09-2009, 07:51 AM
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.
cgbeige
08-09-2009, 05:37 PM
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.
Aikiman
08-09-2009, 08:32 PM
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?
cgbeige
08-10-2009, 04:55 AM
Bueller?
no one can kill mighty MrParticle?
homedog
08-10-2009, 06:14 AM
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.
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...
Cheesestraws
08-10-2009, 06:54 AM
Aikiman, I believe only the ones listed here (http://download.autodesk.com/us/maya/2009help/index.html?url=Particles_Emit_kill_or_split_particles_upon_contact.htm,topicNumber=d0e390459).
Cgbeige, what is wrong with my method then? You asked for a kill plane/volume and the method I suggested can do that.
Aikiman
08-10-2009, 08:01 AM
Aikiman, I believe only the ones listed here (http://download.autodesk.com/us/maya/2009help/index.html?url=Particles_Emit_kill_or_split_particles_upon_contact.htm,topicNumber=d0e390459).
Cgbeige, what is wrong with my method then? You asked for a kill plane/volume and the method I suggested can do that.
The collisionGeometryIndex output attribute is not supported for nParticles collision events in Maya 2009.
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.
The Nucleus ground plane cannot be the target of an nParticle collision event.
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.
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.
Cheesestraws
08-10-2009, 08:17 AM
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.
Aikiman
08-10-2009, 09:34 AM
Looks like you have to resort back to using the proc call down the bottom of the collision event editor.
Sybexmed
08-10-2009, 10:47 PM
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?
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?
Aikiman
08-10-2009, 10:52 PM
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.
DrEvilBear
03-16-2010, 02:38 PM
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!
Aikiman
03-16-2010, 07:13 PM
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!
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.
Don3Don
03-19-2010, 01:07 PM
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....
DKdontKNO
03-20-2010, 07:49 PM
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! :) thx
Aikiman
03-20-2010, 11:57 PM
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! :) thx
Can you upload you scene?
CGTalk Moderation
03-20-2010, 11:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Moderation
03-20-2010, 11:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.