Copy to points after rbd sim

   2895   6   2
User Avatar
Member
68 posts
Joined: Aug. 2021
Offline
Hello

I need to use a copy to points after a rbd sim, but it doesn't work...

Any idea ?

For the test, i made a simple simulation with a pig head, then create points from the simulation, and when i copy to point the same pighead, it's not working. (blue head are from the simulation, red one are the one i tried to copy on it...)

The only way i can have the correct position, is by unchecked "transform using target point orientations", but then, i loose the rotation/orientation....

Attachments:
pig.hiplc (321.9 KB)
Capture d'écran 2024-04-11 093912.png (2.0 MB)

User Avatar
Member
247 posts
Joined: May 2017
Offline
Hi, it seems that the pivot attribute is taking the points back to the origin, I don't know where it's coming from, but simply deleting the attribute will fix the issue.

Attachments:
pivot_attribute .jpg (39.8 KB)

User Avatar
Member
68 posts
Joined: Aug. 2021
Offline
Sadly it doesn't work :

Attachments:
Capture d'écran 2024-04-11 104436.png (3.7 MB)

User Avatar
Member
247 posts
Joined: May 2017
Offline
Hm, here is a hot fix, but still not perfect. It seems when orient before packing, the origin/centroid of the pig heads get different from the orginal. So, copy to points after all cant work.

The best solution for now is to calculate the 'convex hull center' with the extractcentroid sop, and then subtract the vector for each point of the init. geo. Then import the geo back from the dops and set the import style to Fetch Geo. from.... In wrangle you can then extract a 3x3 matrix and calculate an orient out of it.



I need to look a little deeper.

Image Not Found
Edited by vikus - April 11, 2024 11:51:42

Attachments:
pig_02.jpg (60.9 KB)
pig_02.hiplc (334.4 KB)

User Avatar
Member
68 posts
Joined: Aug. 2021
Offline
Thanks i will try
User Avatar
Staff
445 posts
Joined: Feb. 2008
Offline
The DOP points have a restxform matrix attribute which will allow you to do what you want.
First, add the "restxform" attribute to the DOP Import SOP's "Transfer Attributes" parm so the points get the restxform attrib.
Create a point wrangle SOP and use this code:
4@transform = 4@restxform;
@P = 0;
Add an attrib delete SOP and set it to delete all attributes except "transform".
Plug the output of the attrib delete SOP into the copytopoints SOP.

You now have all of the copied pig heads at their rest position and orientation. Now use a transform pieces SOP on them and use the points from the dopimport SOP to transform them.


Here's the updated hipfile.

Attachments:
pig_fixed.hiplc (335.0 KB)

User Avatar
Member
33 posts
Joined: Jan. 2023
Offline
npetit
You now have all of the copied pig heads at their rest position and orientation. Now use a transform pieces SOP on them and use the points from the dopimport SOP to transform them.

Do you know if your approach works with rbd emitted every frame? Because i can't figure it out ;x
  • Quick Links