29 lines
567 B
JavaScript
29 lines
567 B
JavaScript
if (!this.entityLoaded) {
|
|
return;
|
|
}
|
|
|
|
if (!this.initialized) {
|
|
|
|
this.camera = this.entityLoaded.camera;
|
|
this.buttons = this.entityLoaded.buttons;
|
|
this.raycaster = this.entityLoaded.raycaster;
|
|
|
|
this.initialized = true;
|
|
}
|
|
|
|
var mouse = {
|
|
x : (data.event.offsetX / data.event.target.width ) * 2 - 1,
|
|
y : -(data.event.offsetY / data.event.target.height) * 2 + 1
|
|
}
|
|
|
|
this.raycaster.setFromCamera(
|
|
mouse,
|
|
this.camera
|
|
);
|
|
|
|
this.raycaster.getIntersectedObjects(this.buttons).map(
|
|
function(intersect) {
|
|
console.log(intersect);
|
|
}
|
|
);
|
|
//@ sourceURL=mouseDown.js
|