CinnamonMetal Posted March 18, 2020 Share Posted March 18, 2020 I have a sop solver inside a dopnet for a RBD. This is what is inside the point wrangler, but it's not working for only the packed geometry with an objid of one and three ? if(i@objid == 1 && 3){ @bounce = 1.75; } Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 18, 2020 Share Posted March 18, 2020 (edited) why would you bother using a for each ? - the pointwrangle (or attrwrangle) is already a loop....it loops thru points (or prims) (and subgroups if you specify them) - a point can't have objid = BOTH 1 and 3....it's equal 1 or 3. Edited March 18, 2020 by Noobini Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 19, 2020 Author Share Posted March 19, 2020 I want point or packed primitive 1 and 3. Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 19, 2020 Share Posted March 19, 2020 well it's OR not AND Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 19, 2020 Author Share Posted March 19, 2020 It is AND because I want the point or packed primitive 1 and 3. Quote Link to comment Share on other sites More sharing options...
nuki Posted March 19, 2020 Share Posted March 19, 2020 (edited) noobini is right in both points. The pointwrangle is executed for every point in input 1. Think about it from a single points perspective: It can have an id of EITHER 1 OR 3 for your code to fire. Its a single integer attribute, so how is it ever supposed to be both 1 AND 3? you'd have to use if(i@id ==1 || i@id ==3) {} look at the simple example attached - with these things its often easiest to test them outside of the dopnet if possible. you can even use an expression in the group field to achieve the same. pointwrangle.hiplc Edited March 19, 2020 by nuki Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 20, 2020 Author Share Posted March 20, 2020 When I'm outside of a SOPSolver but remain inside of a dopnet, each packed primitive has their own point; although when I'm inside the SOPSolver inside the DOPNet those same single points have multiple points over lapping ? Therefore my wrangle doesn't do what I want because of the overlapping points ? Quote Link to comment Share on other sites More sharing options...
nuki Posted March 20, 2020 Share Posted March 20, 2020 (edited) you are fetching the impact points tho, not the packed prims? The impact positions could be overlapping if your object is just bouncing in place. Maybe you could share the scene so we are on the same page here. Edited March 20, 2020 by nuki Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 20, 2020 Author Share Posted March 20, 2020 You are probably correct, I'm fetching the impact points. I've attached the scene file; I may not have the wrangler inside the SopSolver correct. rbdtestb.hipnc Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 23, 2020 Author Share Posted March 23, 2020 (edited) If I use @objid == 1 within a SOPSolver does that know to get the packed primitive with an id of 1 within a rbd dopnet ? Edited March 23, 2020 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 25, 2020 Share Posted March 25, 2020 The ObjId has nothing to do with your packed geoemtry. Your ObjId describes the different dynamic objects. for example your RBDpackedobject1 node has objid == 0 and your groundplane has objid == 1 I am a little confused as what you are trying to add a color to? Is it the cubes or the constraints? Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 25, 2020 Author Share Posted March 25, 2020 Do packed geometry have an object id; and if so, how can I use it so forces or color is applied to only the object id for which I want to apply it ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 26, 2020 Share Posted March 26, 2020 yes you can use the s@name string attribute to identify your pieces with. This is why we setup unique names for our packed geometry. So the solver can keep track of each individual piece. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 26, 2020 Author Share Posted March 26, 2020 Considering that there is a name attribute but on primitives in the form of op:/<path> (string) how do I use this path in a SopSolver ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 26, 2020 Share Posted March 26, 2020 2 hours ago, CinnamonMetal said: Considering that there is a name attribute but on primitives in the form of op:/<path> (string) how do I use this path in a SopSolver ? you are mixing things together. That is not a name attribute on the primitives. That is a path attribute. You name attribute exists on the points. Each individual cube is represented by a point. This is what happens when you pack the geometry. So in order to color some of the cubes for instance you need the sop solver to be attached to the rigid body solver. Not the constraint solver. (unless you are trying to color the constraint primitives.) See below Lastly in order to access the cube geometry (the points) you need to work from the dop_geometry node inside the sop solver and not the Impacts. Once all of that has been setup you can then write your code. Your code should look something like this: Take note of the fact that the wrangle node is running over the points and not primitives. Since your geometry is packed I only have one point or one primitive available per cube. The name attribute exists on the points, so we have to run over points. A simple string condition does the trick to isolate the desired cubes. Inside the if statement I choose to add my color attribute to the primitive instead of the point which I am running over. This is simply just because Houdini is not very good at displaying colors that sits as a point attribute when dealing with packed geometry. So in order for it to show in the viewport I added the color in a primitive attribute instead. 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 26, 2020 Share Posted March 26, 2020 well done @Jesper Rahlff, finally proof that it's an OR not AND Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 27, 2020 Author Share Posted March 27, 2020 I understand, except; when my boxes hit the ground, they are not being colored ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 28, 2020 Share Posted March 28, 2020 in order to do that you would in another if statement check if they have collided with the ground. Same concept Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 28, 2020 Author Share Posted March 28, 2020 @Jesper Rahlff It appears from your screen shots, that you didn't create an if statement within the SOPSolver, yet when the boxes hit the ground they are being colored. Unless there is something that isn't visible in the screen shots ? Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 28, 2020 Share Posted March 28, 2020 3 hours ago, CinnamonMetal said: @Jesper Rahlff It appears from your screen shots, that you didn't create an if statement within the SOPSolver, yet when the boxes hit the ground they are being colored. Unless there is something that isn't visible in the screen shots ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.