PDA

View Full Version : Make particle collide without moving


theun
08-07-2009, 08:07 PM
Hi,

I have created a grid of particles. I animated a sphere through this grid and make it collide but I don't want the particles to move(I just want to change their color on impact, which I already have done with script). Any thoughts? Shouldn't be too difficult, right? Just can't seem to find the solution.

Thanks

homedog
08-08-2009, 06:14 AM
Last night I wanted to create an effect which need the particle keep position after collision.
the same problem as you.
you can create an vector PP attribute like posStore to hold the position where you want the particles be.
then write like posStore=position; in the creation expression.
and
position = posStore; in the runtime expression,but remember in the runtime after dynamics expression.
then it will work.

Keithtron
01-04-2010, 04:07 PM
Another option is to not use a real collision, but to just look up the particle's distance from the collision object. If the particle's distance from the center of the sphere is <= the sphere's radius, then change the particle color. This should work just as well as the collision method, since your collision object is just a sphere, and you won't have to worry about particles getting pushed around. However, if you want to use non-spherical collision objects, then this method won't be as accurate.

Keithtron
01-04-2010, 06:25 PM
EDIT: Ooops, wrong thread. Sorry!

Duncan
01-04-2010, 08:54 PM
If you want it to push other particles, but not be pushed, you could make it's mass very high at the desired frame. However it might still move a little, so it is probably best to save the position in a vector and set it as suggested by homedog.

Duncan

mandark1011
01-05-2010, 04:23 PM
you could also set the resilience of the collision to -1 (if its normal particle) then just call the event in your expression


oops didnt realize your particles were moving before the collision

Duncan
01-05-2010, 06:35 PM
Another technique when it is not practical to change a per-particle property is to kill the particle and emit a new particle at the same location into a second particle system(that has the desired property). This can be done with events, or if more control is required with the emit command inside a particle runtime expression.

Duncan

mandark1011
01-05-2010, 08:03 PM
since your active on this thread Duncan I was wondering if there is a way to create a collision with no collision with Nparticles?

Sorry to highjack your thread...:)

thanks

Duncan
01-05-2010, 09:26 PM
If by "collision with no collision" you mean that the particle pushes other particles but is not pushed by them, then there are a variety of methods.

If one particle has very high mass relative to the other particles then this will be the case, although it requires infinitely more mass to totally have zero effect(in essence being a passive collider).

If it is between two particle systems one can use the collision layer feature. If the difference of the collision layers is 1.0 or greater then the particle system with the lower layer will be like a passive rigid object in terms of collisions with the higher layer ones.

One can create constraints between particles that both turn off collisions as well as ones that selectively collide by using the collision feature on the constraint. However applying nConstraints to particles currently can only apply to individual particles if they are initial state particles( as opposed to emitted ones ). For emitted particles the constraint will only work when applied to entire particle systems as opposed to individual particles. For a constraint to work in a one way fashion requires that the weight be set to 0 on one of the constraint component nodes.

It is not quite the same as collisions, but one can turn off collisions and instead use a repulsive force field generation on the particles. Negative self attract can be used for self collisions. Collisions this way are not always stable, do not have friction and tend to be bouncy. However there is the attribute pointFieldScalePP which is used by the pointFieldScaleInput attribute, but can also be set in an expression if desired. This allows one to have some particles push others with some not pushing.

Yet another method is to first cache a particle system then collide a second with the cached version( although the collision layers is perhaps a simpler way of doing the 1-way collision between two systems ).

Duncan

mandark1011
01-05-2010, 10:52 PM
thanks duncan I will definitely play with all these suggestions.

and just to clarify.. in cases where i want a "collision with no collision" in normal particles i simply set the resilience of the collision to -1 and script behavior based on the event. so although no behavior change has occurred with the normal particle and they pass directly through the collision object it records the event.


with the Nparticle systems the passive object is where im running into issues. I haven't been able to find a way to make Nparticles travel through a passive object but still record the fact that they have.

thanks

Duncan
01-05-2010, 11:08 PM
Ah... I didn't understand your question. You want collision events for a particle without the collisions affecting the particle motion. It is easy to see where this would be useful, but I'm not sure it is currently possible in nParticles. I'll check and see if I can find a workaround.

Duncan

Keithtron
01-05-2010, 11:30 PM
Well, it's not an ideal solution, but you could always script your own basic collision detection! That's more or less the solution I mentioned earlier. It wouldn't be too tough if you're just colliding with basic primitives.

Also, Duncan's earlier solution to kill the particle and emit an identical particle into a 2nd particle system sounds like it could do the trick as well.

mandark1011
01-06-2010, 12:45 AM
thank you very much Duncan...im not a great scripter but ive slowly been developing a bunch of "particle starts" expressions and i use this technique a lot it would be great if they could be tailored top nparticle systems too.

cheers

CGTalk Moderation
01-06-2010, 12:45 AM
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.