Copy to points with a fractured object

   952   1   2
User Avatar
Member
4 posts
Joined: Nov. 2019
Offline
I'm trying to scatter a fractured object (in this case, a tree, trying to make a destructible forest) via CopyToPoints, but I'm facing an issue where it also copies the same name attribute, thus making the simulation unusable.
I've tried solving it via creating a name attribute per point on the grid, but to no avail.
I've used that on the grid:

s@scatteredpoint = itoa(@ptnum);
s@name = 'scattered'+@scatteredpoint;
Then,I copied the geo to the grid, and tried using the following:
@name = @name + ftoa(@scatteredpoint);
But to no avail. ftoa doesn't seem to be recgonized at all, even tho it is listed in the SideFX website (https://www.sidefx.com/docs/houdini/expressions/ftoa.html), and without it I'm getting an error:
Call to undefined binary operator 'string = string + float'. (4,15)
Does anyone have any ideas as to how to solve this?
I'm attaching the hip file below, because I'm unsure if I'm allowed to share the model I'm using here I've replaced it with a cube, but the issue should be the same.

Attachments:
ScatterQuestion.hip (1.5 MB)

User Avatar
Member
405 posts
Joined: April 2017
Offline
RBD Pack and Unpack can resolve this for you automatically.

Use RBD Pack before the Copy to Points operation, and ensure that your points have a simple index attribute to separate them later (I just changed your wrangle to say
i@index = @ptnum;
).

Post-copy, use RBD Unpack and enable "Enforce Unique Name Attribute Per Instance", then enable the Index Attribute. The name attribute will automatically be updated on your primitives as well as the matching constraints.
Edited by toadstorm - May 30, 2023 13:32:19
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
  • Quick Links