Unable to get playground example (goldberg polyhedron) working in npm/typescript project
I am super impressed by your Goldberg polyhedra examples, here: https://playground.babylonjs.com/#A8VZGP#9
I would love to start using this in a game project. However, I am struggling to get access to the extended methods in my npm project (I have tried a variety of starter/template projects). Apologies if this is a rudimentary issue with my understanding of typescript, but I thought others may have the same issue.
This code from the playground above is working:
const makeGoldberg = function(m, n) {
const goldberg = BABYLON.MeshBuilder.CreateGoldberg("g", {m: m, n: n});
const colset = [];
colset.push([0, 11, new BABYLON.Color4(247 / 255, 150 / 255, 70 / 255, 1)]);
for (let k = 0; k < 12; k++) {
colset.push([goldberg.relFace(k, 0), goldberg.relFace(k, goldberg.nbFacesAtPole - 1), new BABYLON.Color4(k % 2, Math.floor(k / 2) % 2, Math.floor(k / 4), 1)]);
}
goldberg.setFaceColors(colset);
return goldberg;
}
My code (below) fails to recognize setFaceColors:
var goldberg = BABYLON.MeshBuilder.CreateGoldberg('g', {m: 2, n: 1});
goldberg.setFaceColors([]);
Error:
Property 'setFaceColors' does not exist on type 'Mesh'.
Template project: https://github.com/pandadelphin/babylonjs-typescript-webpack-starter (before adding my changes above).
Babylonjs version: 5.0.0-alpha.65
I'm really keen to push / promote babylonjs, and would appreciate a little help here. Thanks!
Can you please move the conversation to our forum https://forum.babylonjs.com/ ?
Github is reserved as the template mentioned for valid issues discussed on the forum first.
You will need to provide more info there like an actual repro as your code is also working on the playground: https://playground.babylonjs.com/#A8VZGP#32 so if the first one works in your project the second would normally do as well