i did this func
var ExisInternalView = pc.createScript('exisInternalView');
ExisInternalView.attributes.add('zoomSpeed', { type:'number', title:'Zoom Speed'});
// initialize code called once per entity
ExisInternalView.prototype.initialize = function() {
var dist=0;
console.log(this.dist);
this.app.mouse.on(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this);
this.on('destroy', function(){
this.app.mouse.off(pc.EVENT_MOUSEWHEEL, this.onMouseWheel,this);
});
};
ExisInternalView.prototype.onMouseWheel = function (event) {
this.dist -= event.wheel * this.zoomSpeed * (this.dist * 0.1);
console.log(this.dist);
};
but for some odd reason, although i believe i defined the var ‘dist’ properly, when i scroll the wheel,
dist is printed in the initilize as undefined (but it was defined 1 line ago)
and the OnMouseWheel its been printed as NaN
am i missing something?