Show Dimensions with Lines does not work as Expected with Rotation

Heyho,

i have a new Problem…

I will show the Dimensions of a (importet) mesh, which will works fine, if the Mesh is Rotate to a 90deg angle.
https://www.babylonjs-playground.com/#QP43YZ

But with a Rotation of 45deg or something else, it is not, what i want.
https://www.babylonjs-playground.com/#QP43YZ#1

I need that the Rotation does not Matter. It has to Act the same with and without Rotation.

Hope you can help me? :slight_smile:

Mfg
Daniel

Hi @Rotzend.
Maybe using local size instead of world size, can be an option, see line 41
Or maybe calculate the dimensions before to apply the rotation, or you can check if the mesh has rotation, if it has store it in a variable, reset it to 0,0,0, calculate the dimension and aply again the rotation.
Only a few options, but stay tune I bet more will come. Cheers!

hey Thank you for Reply,

but this does not work at all…

With my merged Objects (its all meshes from the Import just Merged for Size & Center) does this not work, because it does not get rotation… (rotation has 0)

but without this, your answer work fine!

Have anyone a Solution without knowing the Rotation?

The problem is quite complex if you bake the rotation inside the mesh (as you mentioned).

From a geometry standpoint your mesh has no rotation so you need to open the mesh to “deduce” the rotation but this is really complicated. I will recommend not to lose the rotation if you can

I have solved the Problem with the Lines. But all i try does not work with the Text… :confused:
I’ve tried to reproduce the Error, but it does not work…

I can’t show you the imported Object, but i can show you a part of it and i screenshoted all need Parts. Maybe you cann see a solution for that? :slight_smile:

----- The Code -----


With all other deg Rotation-> all deg convertet to rad
meshRotaion: e {x: -1.5707963267948966, y: 1.5707963267948966, z: 1.0471975511965976}

2019-07-30%2013_53_43-Webkonfigurator


With 90deg rotation (or 0, 180, 270 and 360)
meshRotaion: e {x: -1.5707963267948966, y: 1.5707963267948966, z: 0}

2019-07-30%2013_51_08-Webkonfigurator

Could you not reproduce in a playground with a simple box the lines and the text ???

This would help a lot.

No, unfortunately not, otherwise I would do that.

Have tried everything, but exactly the same or a similar problem does not appear.

This is really hard to help on those kind of issue without a repro, both the rotation and position looks wrong for the text plane but without the code, I can not think of anything in particular.