Jump to content

Get centerpoint


kidsreturnjj

Recommended Posts

That would be the centroid of the simulation objects. Didn't mention where you wanted to get the centroids.

Inside DOPs, each simulation object has a pivot point (p) defined from the origin along with the current position (t) in the Position sub-data. Just add the two gives you the pivot point world location. You can access this with the dopoption() or dopoptions() expression. For example in any DOP parameter processing the RBD objects, you could fetch "p" by:


dopoption("/obj/AutoDopNetwork", $OBJ, "Position", "py")
0.5299
[/CODE]

or

[CODE]
dopoptions("/obj/AutoDopNetwork", $OBJ, "Position", "p")
[0, 0.5299, 0]
[/CODE]

Just do the same for t and add the two together.

Another way is to use the Dynamics CHOP and fetch p and t there and add the two together with a Math CHOP.

Fetching RBD simulation objects (bullet or RBD) with the DOP Import SOP, you have several options of which one is "Create Points to Represent Objects" which is that actual pivot "p" plus position "t" along with a bunch of other attributes to set you up for low-high res geo substitution and instance rendering. You can copy/paste the existing DOP Import SOP and have one to fetch the geometry and the second to fetch the points. They will both have the same order to them making indexing the two straightforward.

If you are loading in geometry blind and don't have any of the DOP data available, then you have to build your own centroids by using a ForEach SOP and loop over every group (pre-processed with a Connectivity and Partition SOP combo to create the groups) and yes use an Add SOP with the centroid() expression mentioned above pointing to the Each SOP inside.

There should be examples of all in various forums for the above methods.

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Fetching RBD simulation objects (bullet or RBD) with the DOP Import SOP, you have several options of which one is "Create Points to Represent Objects"...

Thanks! This was exactly what I was looking for!

I was initially going for the For Loop method, but it was taking too long to do it over thousands of bullet objects.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...