Jump to content

Particles collision based on groups


dus.marjanovic

Recommended Posts

Hello guys,

I want to make particles to collide with sphere but particles that are inside of that sphere, which is static object.

I have group based on volumesample and particles inside of that sphere should collide, because "pop collision ignore" node is set to that group.

It look's straight forward, but I guess there is some technical problem why this does not working for me.

For some reason I can't upload file here, so here is google drive link

Hope that someone can explain to me.

Thanks,

cheers.

Link to comment
Share on other sites

Shouldn't the final line in your PopWrangle be this..

@group_inside_particles = @inside_attribute;

You have..

@group_inside_particles = @inside;

This line actually makes an additional attribute on your particles called inside and sets it to zero. So group_inside_particles is always zero.

Also there is no reason to create a temporary variable as an attribute, that  just adds more memory weight to the particles. If you had a use for inside_particles as an attribute further down the line, it would make sense but because it is essentially a copy of the group itself you don't really need it as an attribute. If you explicitly type cast it as an int it only exists temporarily while the code is executing then gets freed when the script ends and thus takes up no additional memory after that.

@Cd = {0,0,0};
int inside_attribute = 0;
if (volumesample(2,"surface",@P)<0)
{
    @Cd = {1,0,0};
    inside_attribute = 1;
}
@group_inside_particles = inside_attribute;

 

Edited by Atom
Link to comment
Share on other sites

Thanks for reply,

yes, it should be like that, but while I was cleaning file for upload i forgot to change bottom line. I know for temp attributes, but since I still learning Houdini it is much easier for me to visualise in geometry spreadsheet :D .

So, when you turn off "staticobject1" and run a sim, you can see that particles which are inside of sphere are Red and in group "inside_particles". In theory if I assign this group to "popcollisionignore1", it should affect only that particles that are in group. I was trying with other way around, when particles that are inside of sphere are not in group and will not be affected by node collision ignore and should collide (which have more sense), but still does not work.This is new code:

Quote

@Cd = {0,0,0};
i@inside_attribute = 1;
if (volumesample(2,"surface",@P)<0)

{
    @Cd = {1,0,0};
    @inside_attribute =0;

}

@group_inside_particles = @inside_attribute ;

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...