私はBabylonJSが初めてで、そのようなカスタムメッシュを作成しました(正しい方法かどうかはわかりません):
function DragSphere() {
this.sphere = BABYLON.Mesh.CreateSphere("sphere", 15, 2, scene);
this.sphere.material = new BABYLON.StandardMaterial("sphereMat", scene);
...
return (this.sphere);
}
DragSphere.prototype.setRGBColor = function(r, g, b) {
this.sphere.material.diffuseColor = new BABYLON.Color3(r/255, g/255, b/255);
}
SetRGBColor
だから私はその色を更新するために私の方法を使いたいのですDragSphere
が、ブラウザは私に同意していないようです:
Uncaught TypeError: sphere.setRGBColor is not a function