canvas_geometry_birds改变mousemove进行点击?

时间:2015-05-20 12:31:04

标签: javascript onclick three.js

我应该如何或在哪里修改此示例中的点击交互的悬停交互?我尝试将mousemove更改为click,mouseup或mousedown,但这不会使任何成功的点击交互。你可以,请给我一个提示如何修改这个?我想这个功能必须与它有关,但我有一些难以找到解决方案。

 document.addEventListener( 'mousemove', this.documentMouseMoveHandler.bind(this), false );

documentMouseMoveHandler: function ( e ) {
    var boid,
        offset = this.offset,
        boids = this.boids,
        vector = new THREE.Vector3( e.clientX - offset.x - this.halfViewWidth, - e.clientY - offset.y + this.halfViewHeight, 0 );

    //TODO: the scalar is a projection scaling number that is deduced from trial & errors, will find the correct formular to convert projection later
    vector.multiplyScalar(0.83);

    //debug
    //this.cube.position = vector.clone();

    //trace(3, 'offset: ' + offset.x + 'x' + offset.y + ' - vector: ' + vector.x + 'x' + vector.y);

    for ( var i = 0, il = boids.length; i < il; i++ ) {
      boid = boids[ i ];
      vector.z = boid.position.z;
      boid.repulse( vector );
    }

  }

0 个答案:

没有答案