Center a Sprite3D only on one axis

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TobiLa

Hey there,
I have a coordinate where I want to place my Sprite from code. I want it to be centered on the x axis, but not on the y axis.

enter image description here
The rectangle is my sprite, the red cross the coordinate I have.

When using 2D this is easy, I could just get the width of my sprite with


and then add it to the x positition devided by 2.

How can I achieve the same thing with a Sprite3D? Using the texture width doesn’t work, because the coordinate system isn’t in pixels anymore.

So basically for my approach I would need to know how to get the width of my sprite in the metric coordinates.
But I’m grateful for every approach there is.

Thanks in advance!