我对 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
my 的方法DragSphere
来更新它的颜色,但是浏览器似乎不同意我的看法:
Uncaught TypeError: sphere.setRGBColor is not a function