Hi,
In some cases, when i try to create a concave polyhedron, some faces doesn’t render as expected.
Hi,
In some cases, when i try to create a concave polyhedron, some faces doesn’t render as expected.
That’s probably that the winding of these faces is wrong: you will have to reverse the order of the vertex indices for these faces (instead of being (index1,index2,index3), it should be (index1,index3,index2)).
In reference to this answer you provided, how can i do to create a “U” polyhedron like on this PG
I tried using ExtrudeShapeCustom
, which mostly works, but there are some rotations where the U turns:
I don’t know if this is fixable or a by-product of the method…
The algorithm proposed in this video is, perhaps, a good replacement for the current calculation method?
Actually, it happens that the existing ExtrudePolygon
method can be used:
Yes but the ExtrudePolygon works only in a XZ plane with Y extrusion.
It works for my needs with a simple “if the plane is horizontal use Extrude else use Polyhedron” : https://playground.babylonjs.com/#5XGGIC#5, but it still particular
You can also rotate the mesh after extrusion if it’s not in the right orientation.
Not really cause my points are not always in the XZ plane, I could do something like project them on the XZ plane but I don’t know if BABYLON propose that and if not I think that I’ll have to do a lot of calcul
If your points aren’t in a plan, I don’t think we have a solution in Babylon indeed.
Hi everyone,
I answer to this post because i’ve the same problem as @VerandaLouis .
I mean, it is really difficult to build a polygon in space in BabylonJS because there are probably too many ways to do but each way has restrictions.
Today, i think that there are 3 methods :
BABYLON.MeshBuilder.ExtrudePolygon : shape has to be done in the XZ plane, doesn’t allow arcs in the shape
BABYLON.PolygonMeshBuilder : shape has to be done in the XY plane, allows arcs
BABYLON.MeshBuilder.CreatePolyhedron : the plane of the shape can be anywhere but the concave shapes are not well done.
For instance, we are not able to draw a concave shape which is in a plane different from XY or XZ. Projecting points on the XZ or XY plane is not as easy as it appears first especially if you don’t have only segments but also arcs.
May be a new feature should be to have only one general method to draw a polygon if it is possible. What could be done is to define a shape which is in a plane (but not XY or XZ) and extrude it along its normal.
Thks.