Hello everyone,
I want to add in my app square area calculations. I made a playground of it here: https://playground.babylonjs.com/#QNJLCY#18.
My problem starts when I want to move it to my angular application. How should I use PolygonMeshBuilder to work like MeshBuilder.CreatePolygon?
*edit it occurs my model is rotated 90 degrees in X-axis, but I guess that shouldnt be a problem
this is how it’s working in my app:
how it should work(like in playground):
This is how I make it in my app:
createPolygon(polygon: Polygon, scene: Scene) {
const { pointsMeshes } = polygon;
//this is just array of clicked positions
const spheresPositionsArr = pointsMeshes.map((e) => {
return new Vector3(e.position.x, e.position.y, e.position.z);
});
const polygonMeshBuilder = new PolygonMeshBuilder(
"polygonMeshBuilder",
spheresPositionsArr,
scene,
MyEarcut
);
const polygonMesh = polygonMeshBuilder.build();
return polygonMesh;
}