# Collision of nParticles based on the normal of the surface?

 03 March 2011 spacerweb starlighter Igor Jovanovic FX Techinal Director London, United Kingdom 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; } else nParticleShape1.collideStrengthPP = 1; Thnx. __________________ Keep walking! Last edited by spacerweb : 03 March 2011 at 08:40 AM. share quote
 03 March 2011 ginodauri Know-it-All breeder fff, Serbia 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;} if(check==1){collideStrengthPP=1;} else{collideStrengthPP=0;} 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? share quote
 03 March 2011 animatedfox what the ?!?!   portfolio Benjamin Fox Seat 43 USA This looks good This thread seems to get where you are looking to go...hope it helps. http://forums.cgsociety.org/showthr...collide+normals share quote
 03 March 2011 Duncan Expert   Duncan Brinsmead Principal Scientist Autodesk Canada 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. Duncan share quote
 03 March 2011 spacerweb starlighter Igor Jovanovic FX Techinal Director London, United Kingdom 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! share quote
 04 April 2011 ginodauri Know-it-All breeder fff, Serbia 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. if(p.check==0) { float \$pos[]=p.position; vector \$closNormal= python("closestNormal(["+\$pos[0]+","+\$pos[1]+","+\$pos[2]+"])"); float \$dot=dot((p.velocity),\$closNormal); if (\$dot<0) { p.collideStrengthPP=1; p.check=1; } } /*pymel proc def closestNormal(point): mesh=pm.PyNode("collisionMesh") 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. share quote
 04 April 2011 CGTalk Moderation Expert 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. share quote

 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 CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.