How do I center objects without the use of pivot?

Hi there. I have to make a turntable in UE4. I have a problem though: Most objects are modeled/imported far away from the origin in Maya. When imported, this results in pivots that are very distant compared to the object within UE4. As a result, rotating or centering objects to appear in-camera for the turntable has been tricky.

I need a way to center these objects that have distant so I can make them rotate and render in a turntable, without the use of pivot calculations, because those pivots are completely off.

They are hundreds of assets, so I can’t ask modelers to “just fix the pivot”.

After the export, the only way is to create a BP for each mesh and set a relative location in relation to the root.

For example, this cube was exported having its pivot 7.24 m (in x) from the center. So, I created a BP, and set it’s location to -7.24m (in x) relative to the root:

Now, it’s like the pivot of the cube it’s centered:

307749-2.jpg

I generally move it to the origin, export, and put is back where it was. Neither Blender nor Autodesk programs account for the actual object origin, and that’s sad.

You can also make a new actor… have a scene component and a static mesh component… and place static mesh in relation to the scene root component as you like (so centered in any point you wish for).

Is there a way to find this new center with Blueprints? I have thousands of objects, and manual re-positioning inside Unreal Might prove too time consuming to consider it appropriate for the current project budget.

I’m afraid not. The object’s pivot point is lost during the convertion from .fbx → .uassets. You can verify that by exporting a model from unreal to fbx and open it in Maya. The object’s pivot point will be at (0,0,0).
So, I don’t think it’s possible to know the required re-positioning values.

There are scripts for Maya that automatically deal with this pivot and origin issue. So I suggest you start using one of them or implement one.

PS: note if a mesh is already in the world, you can change it’s pivot point https://www.youtube.com/watch?v=N1h5mMviSKs and https://www.youtube.com/watch?v=GWJbNuWXgrY. This removes the need for creating a BP for each mesh, but you still have to do it manually.

I’m not doing the models, or have the capacity of altering that part of the decision. And I only need to find the center of mass for the turntable

If the table has a vertex in the center, you can:

  1. Snap the pivot to the center (hold Alt+V and drag the pivot with the middle mouse button (you have to click on the white ball));

  2. Save the pivot offset (right click, Pivot => Set as Pivot Offset);

  3. Add a cone and snap the table to the top of the cone (this time holding V and moving the white ball with LMB);

  4. Parent the table to the cone;

  5. Select both, press Blueprints (at the top of your viewport) => Convert Selection to Blueprint Class => Harvest Components;

  6. In the cone details, reset the mesh to none or just make it invisible. It will now be the new root.

  7. Now the table rotates around its center.

If the table doesn’t have a vertex in the center, but if you know the precise radius of the table, you can do the same with one of the outer vertices, and then just offset the table relative to the cone by the radius value.

If the table doesn’t have a vertex in the center and you don’t know the precise radius, that’s too bad. You’ll have to eyeball it somehow.

So, here is the most adaptable solution I could find, without going as far as creating a plugin.

Create a BP, with a scene as root, a static mesh component and a static mesh variable (visible), and put this script in the construction:

If you want, you can set a default mesh in the variable.

Now, you put it in the world, select any mesh that it’s offset or not and it will automatically move the center of the mesh to the center of the BP:

No need to manually set the re-positioning values of the mesh.

A little update if it’s still relevant. You can use the “Modeling Tool Editor Mode” plugin. It can automatically set the pivot to the center of the mesh and do lots of other stuff.

Special thanks to @ClockworkOcean for pointing out that such a plugin exists.

Edit: You need to enable the plugin in Edit => Plugins first.

Thank you so much for this.

I was looking all over for this simple of a solution. I needed it to re-center a line trace on a large instanced array. Previously the line trace was off in a weird location and now, bringing in your above logic, the line trace is always in the center of my arrayed meshes regardless of how many there are. THANK YOU!