Set model rotation point to center

Hello there. Ich have a model of a window of a building which geometry center is not at the middle of the object but at the left-bottom. Additionally the model is too huge according to it’s world (grid). So when rotating the model it’s not turning around it’s center but around point left-bottom like an egg. I tried to modify the model with “SetGeometryCenter(0,…)” method at runtime before adding it to the root node, but nothing changes.
Can you help me with some code to modify the model so that it rotates around its center? Huge thanks

The easiest way to fix transforms is on the level of Scene.
E.g. if your model has wrong center, you:

1. Add root node where the center of your model should be.
2. Add child node used for offset.
4. Move child node used for offset so the center of the model is where you want it to be.
5. Rotate root node.

It works, thank you

//Root node for rotation
Node rootNode = Scene.CreateChild(“RootNode”);
rootNode.Position = new Vector3(x: 0, y: 0, z: 0);

//Child node with negative offset to emulate new center of the model
Node childNode = rootNode.CreateChild(“ChildNode”);
childNode.Position = new Vector3(x: -10, y: 0, z: 0);

//Model at child node
StaticModel model = childNode.CreateComponent();
model.Model = ResourceCache.GetModel(“Window.mdl”);

But at childNode.Position I have entered a fixed offset for x of -10 that works for my “Window.mdl”. But how can I calculate the offset according to the size of the model?

Regards