Tilted polyhedra

I am following the tutorials to get to know better Babylon and I am stuck in a very basic issue.


When I try to create a Hexagonal Prism, it is tilted on the scene, and scaleX, scaleY or scaleZ distort the object instead of properly scaling it.

Am I missing something?

1 Like

The polyhedra from the collection are built from pre-computed data coming from an external source. This computation doesn’t necesseraly align the shape axes with the world axes.

Thanks for the answer, jerome.

I’m sure you are aware of that, but the problem is not that the axes are not aligned to the world axes, it is not aligned to itself.

If it was just a matter of align to the world axes I could just rotate it, but rotation will not make the scaling along its own axes any better.

ok, I was wrong : it’s not necesseraly aligned with the local axes.

1 Like

Is there a way to align it? Or should I build the object by myself?
How does people use it?

tilted polyhedra sounds like a math bar.

1 Like

If you just want a hexagonal prism then it is easy enough to build yourself Babylon.js Playground

Other polyhedra much more difficult?

Playing around with the hexagon prism (the easy one), found the angle to to Y axis, rotated so local y axis matches, and baked transformation. Scaling is OK but x and z swapped. Much more of a problem with other polyhedra.


Hmm yeah I could use axis aligned polyhedra as well. At least for all predefined ones. :slight_smile:

I used to work with them from another 3D editor. And scale them at free will into their axis aligned directions. I find all these basic shapes great for creating complex meshes just like building starwing fighters from LEGO bricks.

But the tilted polyhedra from BABYLON.MeshBuilder.CreatePolyhedron have been a fight for finding math angles so far for me, I could write a whole kindergarten match-the-shape game about it… :broken_heart:

1 Like

Thanks a lot for your help, John.
I found very weird that the available polys had this issue. Definitely extruding a shape is a nice workaround.