I have made a test project where if I click on aim and drag it on the surface, it should move.
It is working alright on PC browsers but on mobile, it is not working as expected. in “on touch move”, somehow it cant find the raycast result continuously but it does once in “onTouchStart”.
Your _onTouchMove callback works but it returns an array of gestures, not x,y coordinates directly.
You need to grab a gesture, in this case the first one and get the coordinates from there. Then it will work as expected:
MoveEnvironmentAim.prototype._onTouchMove = function(event) {
if(this.isAimSelected){
var touch = event.touches[0];
var from = this.mainCamera.getPosition();
var to = this.mainCamera.camera.screenToWorld(touch.x, touch.y, this.mainCamera.camera.farClip);