Hi, I am shattering a geometry and then I want to attach a particles to each shattered piece. One solution would be to create bounding boxes for each shattered piece and then calculate the center of the bounding boxes and stick particles to it. How would I create a bounding box around each piece and calculate the center?
thanks,
how to calculate center of bounding box of shattered piece?
10363 3 0-
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
-
- graham
- Member
- 1926 posts
- Joined: Nov. 2006
- Offline
There's a few different ways you can go about it. Most will give you the same result.
If you jump into the ForEach SOP in the attached file you'll see 4 different ways. The 3 on the left give you the exact same result, which is a point in the center of the bounding box of the piece. They do this in slightly different ways however.
The singular Add SOP creates a point and positions it using the centroid() expression which returns the center position of the bounding box of the geometry of the target node.
To help visualize the bounding box you can use a Bound SOP to create a box around your object. You can also just plug in the geometry to the input of a regular Box SOP. They give you the same result.
In another instance we take the resulting bounding box, scale it down to 0 with the pivot at the center of the geometry and fuse the points to create one point at the center. The other method is similar to the individual Add SOP before but uses the local variables to get the center then deletes all the points not the center.
The other way is a bit different. The VOP SOP approach gives you the averaged position of all the points in the geometry. In most cases this result will differ from the other ways, however it will give you a point position that is a bit more in the “center” than the bbox center when your shapes are not uniform. It's more along the lines of the actual center of mass.
Hope that helps.
If you jump into the ForEach SOP in the attached file you'll see 4 different ways. The 3 on the left give you the exact same result, which is a point in the center of the bounding box of the piece. They do this in slightly different ways however.
The singular Add SOP creates a point and positions it using the centroid() expression which returns the center position of the bounding box of the geometry of the target node.
To help visualize the bounding box you can use a Bound SOP to create a box around your object. You can also just plug in the geometry to the input of a regular Box SOP. They give you the same result.
In another instance we take the resulting bounding box, scale it down to 0 with the pivot at the center of the geometry and fuse the points to create one point at the center. The other method is similar to the individual Add SOP before but uses the local variables to get the center then deletes all the points not the center.
The other way is a bit different. The VOP SOP approach gives you the averaged position of all the points in the geometry. In most cases this result will differ from the other ways, however it will give you a point position that is a bit more in the “center” than the bbox center when your shapes are not uniform. It's more along the lines of the actual center of mass.
Hope that helps.
Graham Thompson, Technical Artist @ Rockstar Games
-
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
Thanks buddy,
That helped a lot and thanks for different examples too.
Now Once I have a point for each piece, I want the shattered pieces to move along with it. I tried using primitive SOP to transform the geometry but when I connect the shatter node to its first input and popnet to the other, I am not getting the result I am expecting. The geometry is connected and it pops in the beginning frame. Any idea how to fix this and have the individual pieces move along with the particles. I have also attached the file I was experimenting on.
thanks,
That helped a lot and thanks for different examples too.
Now Once I have a point for each piece, I want the shattered pieces to move along with it. I tried using primitive SOP to transform the geometry but when I connect the shatter node to its first input and popnet to the other, I am not getting the result I am expecting. The geometry is connected and it pops in the beginning frame. Any idea how to fix this and have the individual pieces move along with the particles. I have also attached the file I was experimenting on.
thanks,
-
- Ratmann
- Member
- 110 posts
- Joined:
- Offline
-
- Quick Links


