If Statement error - Trying to create a group

   2530   12   1
User Avatar
Member
17 posts
Joined: June 2017
Offline
i@activeGroup = 0;

if(@P != @initpos)
{
@activeGroup = 1;
}
else
{
@activeGroup = 0;
}


I have an RBD sim where I want to isolate only the pieces that are moving and put them in a group so I can create a volume that emits from those pieces only. In this code, I am asking that when the initial position is different from the position, then group into “activeGroup”. Am I approaching this the right way. I just want to group the pieces that have velocity and move after broken constraints.

Thanks
User Avatar
Member
17 posts
Joined: April 2020
Offline
Did you ever get an answer to this? Trying to do the same thing.
User Avatar
Member
133 posts
Joined: March 2016
Offline
Does it just need the 'i' before the @ - and might be worth being explicit on the v@ too

i@activeGroup = 0;

if(v@P != v@initpos)
{
i@activeGroup = 1;
}
else
{
i@activeGroup = 0;
}
Love Houdini
User Avatar
Member
17 posts
Joined: April 2020
Offline
Im not sure. inside and outside faces are exported in the alembic as prim groups and come into c4d as selections. I'd like the activegroup to be the same.

My node setup is probably wrong, but this give me the activeGroup as a prim group, only nothing gets put in the group.

Attachments:
houdini_7qQKQMPQAh.png (210.7 KB)

User Avatar
Member
133 posts
Joined: March 2016
Offline
ah okay so you need to change it to: i@group_activeGroup = 1;
The previous thing was just assiging an attribute not a group.

i@group_activeGroup = 0;

if(v@P != v@initpos)
{
i@group_activeGroup = 1;
}
else
{
i@group_activeGroup = 0;
}
Love Houdini
User Avatar
Member
17 posts
Joined: April 2020
Offline
That works to get activeGroup as a face selection like inside/outside, but everything is in the group. Doesnt look like "v@P != v@initpos" is separating them into in/out of the group.

Any other ideas?

Maybe testing whether its constraint is broken or not instead would work?

Really appreciate the help.
Edited by ironsightdesign - Aug. 29, 2023 13:17:02
User Avatar
Member
133 posts
Joined: March 2016
Offline
Would it work if you were just checking if they have a velocity above 0, or a certain value? assuming your other pieces do actually have no velocity.
Edited by Hatchery - Aug. 30, 2023 03:48:23
Love Houdini
User Avatar
Member
60 posts
Joined: Nov. 2021
Offline
i guess it's because you're using a prim wrangle and P and v are usually point attributes.
you could try using the setprimgroup() function inside a point wrangle
User Avatar
Member
17 posts
Joined: April 2020
Offline
I think they need to be prim attributes to get them as selections in the alembic.
User Avatar
Member
133 posts
Joined: March 2016
Offline
yeah thats no problem, i think what eaniix quite rightly pointed out is you need to run over points but then assign to the group on the prims so i think this should do the job.

if(v@P != v@initpos){
    int prims[] = pointprims(0,@ptnum);
    foreach(int i; prims){
        setprimgroup(0,'activeGroup',i,1,'set');
    }
}else{
setprimgroup(0,'activeGroup',@ptnum,0,'set');
}
Edited by Hatchery - Aug. 31, 2023 03:57:28
Love Houdini
User Avatar
Member
17 posts
Joined: April 2020
Offline
Thanks Hatchery.

Changing the wrangle to points and using your code creates the group in the alembic, except everything is in the group, not just the moving pieces.

Thanks again for your help.
User Avatar
Member
133 posts
Joined: March 2016
Offline
Did you set the v@initpos? if not that will be 0,0,0 and so all points will have moved.
Attached a very crude example of it.

Attachments:
Example.hiplc (157.2 KB)

Love Houdini
User Avatar
Member
17 posts
Joined: April 2020
Offline
Thanks Hatchery.

No I didnt...and also didnt add the geo to input 2.

Looks like that works, but might be an alembic limitation now.

Houdini updates the activeGroup as the RBD runs and pieces move, but the selection in the alembic in C4D is always empty. I think maybe selections cant be animated (unless its with C4D fields).

Maybe if it would work if I can get that group as a vertex map in the alembic?

Thanks again for all the help.
  • Quick Links