trying to get non-rotated mesh bounds after mesh rotation
i don’t get it how it goes. why bounds are extended when applying rotation to a mesh?
looks like it wraps rotated previous bounds of a mesh but not the actual mesh min & max. how to get correct bounds?
here’s my actual case what i’m trying to get.
1 initial model transformation
2 fixed rotation
3 what i need
I believe this post and PG should help:
Else, let us know and…meanwhile, have a great day
thanks for reply, reviewed you PG and it’s quite not the result i need the bounding box is rotated with the mesh in this case. i want it not to be rotated to the world matrix like at snapshot
I see. That’s beyond my expertise (although I sort of can imagine something) but rather than my assumptions and loosing time on attempts, I’d like to call-in @Evgeni_Popov I’m sure he’ll give you the solution along with the explanation in no time, will you?
reading the scroll of summoning…
the language is a mix between ‘scratch the back’ and ‘challenge’.
I’m still learning it; we’ll see if it works
i suppose it’s not an easy task. looks like all meshes vertices must be recalculated with applied rotation to get min max values… if there’s no built in api i’ll just create manual parent resizable bounding box, like some clipper. anyway thanks being helpful
The bounding box always take into account the transformation of the mesh.
If you want an axis aligned bounding box, you can bake the current transformation into the vertices, which will reset the transform:
you’re my saviour! бережи тебе господь!
Can you explain why the bounding box is separate from the mesh in this playground: https://www.babylonjs-playground.com/#0TG0TB#101.
If you comment out the ‘createDefaultCamera’ line, they come back together
As you manage the bounding info yourself, you should set
mesh.doNotSyncBoundingInfo = true, else the system can automatically update the bounding info under the hood (for eg, when the world matrix is updated):