如何知道光标所在的对象?
模拟闪光灯事件鼠标移动鼠标。pixi.js v3.0.7
发布于 2015-09-24 21:44:18
使用2d对象时,可以依赖pixi对象回调,如在这个例子中或在那里:
var bunny = new PIXI.Sprite(texture);
// enable the bunny to be responsive to mouse and touch events
bunny.interactive = true;
// this button mode hand cursor appears when you rollover the bunny with your mouse
bunny.buttonMode = true;
bunny.mousedown = bunny.touchstart = function(data) { this.dragging = true; }
bunny.mouseup = bunny.mouseupoutside = bunny.touchend =
bunny.touchendoutside = function(data) { this.dragging = false; }
bunny.mousemove = bunny.touchmove = function(data) { if(this.dragging) drag(); }
bunny.mouseover = function(data) {}
bunny.mouseout = function(data) {}如果你想模仿物体选择的3D世界,你需要一个叫做raycaster的东西。Three.js库内置了一个.
https://stackoverflow.com/questions/32764528
复制相似问题