【发布时间】:2016-05-14 00:35:46
【问题描述】:
所以,我正在尝试使用 cannon.js 和 three.js 制作第三人称游戏,但我遇到了这个错误: Uncaught SyntaxError: missing ) 在参数列表之后 它来自这个脚本:
//create the model
_three.createModel(window.game.models.house, 12, new THREE.MeshLambertMaterial({ color: window.game.static.colors.cyan, shading: THREE.FlatShading });
//loads the model and calls it whatever
var house = _three.createModel(window.game.models.house, 12, new THREE.MeshLambertMaterial({ color: window.game.static.colors.cyan, shading: THREE.FlatShading });
console.log(house.mesh);
//collects the data from the model
_three.createModel(jsonData, scale, materials, isGeometry);
//loads the model
loader.load("js/game/game.models.js", function(geometry, materials) {
window.game.models = { house: geometry };
window.gameInstance = window.game.core();
window.gameInstance.init({
domContainer: document.querySelector("#game"),
rendererClearColor: window.game.static.colors.black
});
});
这应该做的是抓取一个从搅拌机导出的 JSON 脚本并将其导入我的世界,但它没有加载,但它显示了这个不特定的错误。
给出错误的代码行是_three.createModel(window.game.models.house, 12, new THREE.MeshLambertMaterial({ color: window.game.static.colors.cyan, shading: THREE.FlatShading });
如果有任何可能的方法来解决这个问题,或者如果我可以回复更多有用的支持,请告诉我!
【问题讨论】:
-
该错误已经告诉您问题所在:缺少
)。您可以通过添加来修复错误。 -
请注意,这是一个基本的JS语法错误,与three.js、cannon.js或webgl无关。括号需要“平衡”,即对于每个开头
(,您需要一个结尾)。
标签: javascript