0

I have a crosswalk WebGL_Sample based app that behave correctly on all XDK emulators (I am not using XDK, just testing the EMU's) when I try to touch / intersect a Cube with Three.js's "raycaster.intersectObjects".

The problem is that if I shoot it on a real LGP920 running ICS, touch-sliding events are working (like for the sample's sliding cube) but touch-clicking are not whereas, again, everything works fine on EMU's...

Any clue about what is happening ?

here is what I use (the array "objects" contains only one cube element):

    var vector = new THREE.Vector3( ( e.clientX / window.innerWidth ) * 2 - 1, - ( e.clientY / window.innerHeight ) * 2 + 1, 0.999 );
    projector.unprojectVector( vector, camera );

    var raycaster = new THREE.Raycaster( camera.position, vector.sub( camera.position ).normalize() );

    var intersects = raycaster.intersectObjects( objects );

    if ( intersects.length > 0 ) {

        intersects[ 0 ].object.material.color.setHex( Math.random() * 0xffffff );

    }

Thanks !

1 Answers1

0

Ok got it, in XDK emulators the app was reacting when hovering the mouse pointer on the target cube surface but not with the finger on the device.

I should have used with e.touches[0].pageX and e.touches[0].pageY (instead of e.clientX and e.clientY) for the device.