When I create a penta- or hexagon out of 5 or 6 points as ribbon, the part looks flat (screnshot 1) β I use closeArray:false. With closeArray:true it becomes multicolored (screenshot 2).
But if I create a triangle as ribbon, the part is always multicolored no matter if closeArray is true or false - screenshot 3.
Screenshot 1:
Screenshot 2:
Screenshot 3:
Here you can play with the code, but add some light otherwise all the parts are flat and black no matter what color is.
var p1 = new BABYLON.Vector3(7.30505618280194, 18.1708365211235, 2.92976505719245)
var p2 = new BABYLON.Vector3(7.07131758732614, 18.3167337625741, 2.5864270823458)
var C = new BABYLON.Vector3(6.89096338946149,18.3186183396314,2.9755178700534366666666666667)
var points = [[p1 , p2 , C]];
var m = new BABYLON.StandardMaterial(βterrainβ, scene);
m.baseColor = new BABYLON.Color3.FromHexString(β#4C0099β);
r = BABYLON.MeshBuilder.CreateRibbon(βppβ, {pathArray: points, closeArray:true, closePath:false, updatable:false, sideOrientation:BABYLON.Mesh.DOUBLESIDE }, scene);
m.diffuseColor = BABYLON.Color3.FromHexString(β#4C0099β);
r.material = m;
var p1 = new BABYLON.Vector3(-1.59139624065814, -0.0861874801633106, -19.7441652831136)
var p2 = new BABYLON.Vector3(-1.88042876687887, -0.414930951269387, -19.713474352004)
var p3 = new BABYLON.Vector3(-2.31706624493792, -0.332576122967209, -19.6668714737234)
var p4 = new BABYLON.Vector3(-2.46396357215751, 0.0763834489959505, -19.6511763905896)
var p5 = new BABYLON.Vector3(-2.17322734704069, 0.404692534936387, -19.6824634321574)
var p6 = new BABYLON.Vector3(-1.73729749360038, 0.324476434079304, -19.7288494464008)
var points = [[p1, p2, p3], [p6, p5, p4]];
var m = new BABYLON.StandardMaterial(βwaterβ, scene);
m.baseColor = new BABYLON.Color3.FromHexString(β#FF0000β);
r = BABYLON.MeshBuilder.CreateRibbon(βppβ, {pathArray: points, closeArray:true, closePath:false, updatable:false, sideOrientation:BABYLON.Mesh.DOUBLESIDE }, scene);
m.diffuseColor = BABYLON.Color3.FromHexString(β#FF0000β);
r.material = m;
Is there a better way of creating flat parts out of points with specific coordinates?