Search code examples
unreal-engine5

Unreal Datasmith Export - How to set Pivotpoint of Datasmith Mesh?


i'm currently developing a Datasmith export feature for an AutoCAD plugin. I'm almost done but I can't figure out how to set the pivot point of a mesh.

I've sticked to the SDK Guidelines here: https://docs.unrealengine.com/5.0/en-US/datasmith-export-sdk-guidelines/

At some point it says Mesh pivots must be calculated in the mesh so they don't all end up at 0, 0, 0.

Which is something I whould like to do but I can't find a way in the SDK to set the pivot...

I've expected a function like SetPivotPoint(x,y,z) or something like that on one of these types:

FDatasmithMesh IDatasmithMeshElement IDatasmithMeshActorElement

... But nothing :(

Any help please?


Solution

  • I've just understood what is meant by "the pivot point must be baked into the mesh". I've took all the points of the AutoCAD geometries and created meshes out of them as they are. But the mesh itself must be builded around the point where I want the pivot point to be (relative to the mesh).

    So I think the correct way to do this is to translate all the points of the ACAD geometry so that the center point (where I want the pivot to be) is 0,0,0. Then I build the mesh around it and translate the mesh actor, that holds the instance of the mesh, to the position in the scene where the mesh should be.

    Edit: That was exactly the solution...just in case anyone else has the same problem.