Constrain objects to fractured RBD pieces?

   808   6   1
User Avatar
Member
229 posts
Joined: July 2013
Offline
If I fracture a ground surface to break apart in an RBD simulation, is there a way to constrain objects to each fractured piece (like cactus plants on fractured desert ground) so that when the ground fractures, the plant objects attached to each piece will stick and move along with the broken pieces?
User Avatar
Member
46 posts
Joined: April 2016
Offline
Hi,
yes you can do this. See the example file in attachment.

Attachments:
constraints.hipnc (1.4 MB)

User Avatar
Member
229 posts
Joined: July 2013
Offline
Thanks for the file vicvsh. Unfortunately I get errors using it in v18.5. The RBD Constraint Properties shows an error.
User Avatar
Member
46 posts
Joined: April 2016
Offline
In this file I swapped RBD Constraint Properties to Attribute Wrangle sop.
Edited by vicvvsh - Jan. 15, 2024 09:48:29

Attachments:
constraints.hipnc (1.4 MB)

User Avatar
Member
229 posts
Joined: July 2013
Offline
Thank you vicvvsh so much for this! Could you please confirm if my understanding summarised below of how this works is fully correct?:

- The Attribute Randomize creates unique random values for pscale so this can be used later by the Add node to create the constraints.
- The Attribute Wrangle right under the Attribute Randomize renames the scattered points (so name: piece0_2 becomes name: sphere_0, etc), The piece_* will be associated with the fractured ground and the sphere_* will be associated with the copied objects so they can be constrained together. When these are attributes are fed in to the Merge node, the duplicated points with have the same pscale value.
- The Add node creates a polygon line (constraint) between each set of two points that share the same pscale value, i.e. overlapping duplicates. (Since the duplicate points overlap each other, the created constraint is actually just made of a representative “line”).
- The renamed points (sphere_*) are fed to the Copy to Points node so that the objects that are copied to the points inherit this name attribute.
- The RBD Bullet Solver compares the name attribute of the copied objects to the points of the poly line constraints (each poly line constrain has two points, e.g. piece0_2 for the ground polygon on which the point was scattered and sphere_0 (which is the centroid of the copied object). If the match, they will be constrained.

I have a question: In the Attribute Wrangle, you have this code:
s@constraint_type = "all";

Is the purpose of this to lock the rotation and position of the copied objects to the surfaces so the stay in position and do not wobble? Are the options for @constraint_type either: "all", rotation" or "position"?
User Avatar
Member
46 posts
Joined: April 2016
Offline
It's all correct.
I use pscale attribute randomize spheres' size and it was easy to use this attribute in an add sop to create primitives.
I created constraints as primitive with zero length in purpose to place these constraints between the top of the ground and the bottom of the spheres (not centroid) because that gave me more stiff and stable connection.
As for constraints_type - I just decided it more appropriate for this case, you can tray others values.
It's worth reading: Constraint Network dynamics node [www.sidefx.com]
Edited by vicvvsh - Jan. 17, 2024 00:35:38
User Avatar
Member
229 posts
Joined: July 2013
Offline
Wonderful, thank you!
  • Quick Links