Collision of nParticles based on the normal of the surface?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2011
Collision of nParticles based on the normal of the surface?

Hi, i am looking for an expression or a technique where i could use one same surface, but let the particles go through it if they are hitting it from one side, and collide with it if they are hitting it from another.
I believe it could have to do with collisionNormal attribute, but i am just not sure exactly how to set it up, so if anyone can answer, or point me to a relevant thread, i'd appreciatte it.

i tried with something like this, but probably i am making some obvious mistake, since it's not working

if (nParticleShape1.collisionNormal == -1)
     nParticleShape1.collideStrengthPP = 0;
     nParticleShape1.collideStrengthPP = 1;

Keep walking!

Last edited by spacerweb : 03 March 2011 at 08:40 AM.
  03 March 2011
I think you can't do it the that way.

I don't know what you really need here , this is example based on particle position.

//check is custom per particle float attr
vector $wPos=(position);
if(($wPos.y) > 0 && check==0){check=1;}

Basicly i have plane at position 0 0 0 . My emiter is below plane , and particles pass through plane on way up , but on way down they collide.
This is with nParticles.

Maybe you have more complicated model i need this to work with surface normal , that is when particles is in volume , and when get out of volume?
  03 March 2011
This looks good

This thread seems to get where you are looking to go...hope it helps.
  03 March 2011
You might try the following:

On the nRigid for the collision object turn off "collide" and instead set forceField to Along normal. Adjust the field distance to be relatively small, but not so small your particles don't collide at all.
It is not the same as collisions, but might work for you depending on your needs.

  03 March 2011
Thnx a lot for your answers, i have a few way i'll use this, but i really think it would be so useful to all of us to have that option like we have in RealFlow.

Ginodauri, that's one good way, but unfortunately i have a bit deformed surface, so this is not gonna work for me on this one. It's perfect for a plane, and flat surfaces, but just not for this one. Anyway, thnx for interest.

@aniamtedfox Yes, that thread is also very helpful, just the idea of using the black and white image is something i am gonna use this. It's very good idea by KM. thnx for pointing me there.

Duncan, thnx a lot for taking interest in this one, and i hope that new Maya will have this kind of an option...maybe you can share that info with us now?
Keep walking!
  04 April 2011
I don't know , i can't get above example(texture based) to work , because first collision is happen and then in next frame you can manipulate particles.

This is solution based on mesh normal.

float $pos[]=p.position;
vector $closNormal= python("closestNormal(["+$pos[0]+","+$pos[1]+","+$pos[2]+"])");
float $dot=dot((p.velocity),$closNormal);
if ($dot<0)

/*pymel proc
def closestNormal(point):
return mesh.getClosestNormal(point)[0]

basicly run this pymel procedure , and put mel code in particle expression.

If particle is on other side expression constanly checks for normals , if particle pass other side it assigns collideStrengthPP=1.

You can optimize this code to only check for normals when particle is in certain distance range.

Last edited by ginodauri : 04 April 2011 at 06:34 PM.
  04 April 2011
Thread automatically closed

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 Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:54 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.