I’m importing a set of meshes created by converting a USD file. And creating a static mesh component for each mesh and then adding that component to a static mesh actor. There can be anywhere from 1,000 to 100,000 meshes. All the meshes have an origin of 0,0,0. They all line up correctly because the geometry uses an absolute value.
However, I want to determine the real bounding box of the “viewable” geometry (mathematically, in the above I want to subtract something from all the z values) - but I don’t know how to figure out how much and how to adjust the mesh so that it actually changes the bounding box.
Any help greatly appreciated. Many thanks for reading. I feel like I’m missing something obvious!
I believe the value you’re looking for is the Local Bounds. However, what is your goal here? Are you looking to develop a tool to find that offset and transform the object accordingly?
You can only get this value through a blueprint or tool, so this would require iterating over a lot of objects
I don’t mind iterating over all the objects if I can then modify things so that I don’t have to do that every time…
Thanks very much for the tip on Local Bounds. I’ll dig into that more.
So, my approach will be:
(a) Iterate over every component and use local bounds to find the “most minimum” to the “most maximum” and that will be the two points defining my “yellow box”
(b) now I want to adjust all the geometry so I don’t have to deal with the offset all the time
Unfortunately I don’t have control over the process that’s creating the USD file. My other thought was to parse the USD file and manipulate it before importing it into UE. Not sure if that’s more or less viable… Thoughts?
@sarahlenker - sorry for the late reply… I missed this
I haven’t tried adjusting the pivot-point - I doubt that will work as I need to change the origin (my understanding is that the pivot point defaults to the center of the bounding box but can be moved)
I want to update all my meshes. In that above diagram the origin of the model is at the bottom left of the red box. And, in this example, all the meshes (the cyan stuff) have a “z-offset” of 3,000. That offset is hard coded into the actual geometry of every object (i.e. my input geometry has points at x,y,3000+z etc. and not at x,y,z with a transform of (0,0,3000).
Right now, I apply a transform of (0,0,-3000) to the actor (that contains all the static meshes) and I can position things correctly. However, I still have a bounding box that is too big.
I actually can’t replicate your issue. I tried a test where I imported a new mesh with an offset pivot, and it was still able to correctly detect the bounds.
I’m wondering if something is up with your meshes. Are they all parented under the same actor/blueprint? On further research, bounding boxes are automatically calculated, so it’s not anything to do with object import. I would check your object collisions and make sure they’re accurate, and check for any geometry at the origin within the same mesh.