触摸带有人行横道/ three.js所活动和十字路口在Android 4.0.4设备 [英] Touch events and intersections with crosswalk / three.js on Android 4.0.4 device

查看:291
本文介绍了触摸带有人行横道/ three.js所活动和十字路口在Android 4.0.4设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个人行横道WebGL_Sample基于应用程序,正确的行为在所有XDK仿真器(我不使用XDK,只是测试动车组的),当我尝试触摸/相交three.js所的raycaster.intersectObjects多维数据集。

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".

问题是,如果我拍它一个真正的LGP920运行ICS,触摸滑动事件的工作(如对样品的滑动立方体),但触摸点击都没有,而再次,一切正常动车组的精...

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 );

    }

谢谢!

推荐答案

好了它,在XDK在线仿真器将鼠标指针悬停在目标立方体表面上,但不与设备上的手指的应用程序是反应。

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.

我应该与所用e.touches [0] .pageX和e.touches [0](的e.clientX和e.clientY代替),该设备.pageY。

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

这篇关于触摸带有人行横道/ three.js所活动和十字路口在Android 4.0.4设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆