Here is my code:
pc.script.create('MouseCamera', function (app) {
// Creates a new MouseCamera instance
var MouseCamera = function (entity) {
this.entity = entity;
};
app.mouse.disableContextMenu();
app.mouse.on(pc.input.EVENT_MOUSEMOVE, this.onMouseMove, this);
app.mouse.on(pc.input.EVENT_MOUSEDOWN, this.onMouseDown, this);
MouseCamera.prototype = {
// Called once after all resources are loaded and before the first update
initialize: function () {
},
// Called every frame, dt is time in seconds since last update
update: function (dt) {
this.entity.setEulerAngles(this.ex, this.ey, 0);
onMouseMove : function (event){
this.ex -= event.dy / 5;
this.ex = pc.math.clamp(this.ex, -90, 90);
this.ey -= event.dx / 5;
}
onMouseDown : function (event) {
if (!pc.input.Mouse.isPointerLocked()) {
app.mouse.enablePointerLock();
}
}
}
};
return MouseCamera;
});
I’m getting this error, and I don’t know why:
[MouseCamera.js:18]: Uncaught SyntaxError: Unexpected token (
Please tell me if you know what’s wrong.