inxs Posted June 26, 2017 Share Posted June 26, 2017 Hello all, Im very happy with the ArcRotateCamera and its native touch support. Unfortunately there is only one feature I'm missing: The possibility to pan the camera with a 2-finger gesture. It is not possible to move the camera position with the fingers, only rotate it. Is there anybody who already worte an input for this behavior? Thank you Jonny Quote Link to comment Share on other sites More sharing options...
lhx880619 Posted June 26, 2017 Share Posted June 26, 2017 see this On 2017-6-2 at 10:24 PM, lhx880619 said: @davrous already changed the default input(add mode) to support mode switch var panningMode = _this.mode == "panning" || (evt.ctrlKey && _this.camera._useCtrlForPanning) || (!_this.camera._useCtrlForPanning && _this._isPanClick); if ( _this.panningSensibility !== 0 && panningMode ) { _this.camera .inertialPanningX += -(evt.clientX - cacheSoloPointer.x) / _this.panningSensibility; _this.camera .inertialPanningY += (evt.clientY - cacheSoloPointer.y) / _this.panningSensibility; } Quote Link to comment Share on other sites More sharing options...
inxs Posted June 27, 2017 Author Share Posted June 27, 2017 (edited) Hello all, I fixed it by extending the ArcRotateCameraPointerInput (New section after 'two-finger panning'): else if (pointA && pointB) { // if (noPreventDefault) { evt.preventDefault(); } //if pinch gesture, could be useful to force preventDefault to avoid html page scroll/zoom in some mobile browsers const ed = (pointA.pointerId === evt.pointerId) ? pointA : pointB; ed.x = evt.clientX; ed.y = evt.clientY; const direction = this.pinchInwards ? 1 : -1; const distX = pointA.x - pointB.x; const distY = pointA.y - pointB.y; const pinchSquaredDistance = (distX * distX) + (distY * distY); if (previousPinchDistance === 0) { previousPinchDistance = pinchSquaredDistance; return; } if (pinchSquaredDistance !== previousPinchDistance) { this.camera .inertialRadiusOffset += (pinchSquaredDistance - previousPinchDistance) / (this.pinchPrecision * ((this.angularSensibilityX + this.angularSensibilityY) / 2) * direction); previousPinchDistance = pinchSquaredDistance; } // Two-finger panning const panDistanceX = (pointA.x + pointB.x) / 2; const panDistanceY = (pointA.y + pointB.y) / 2; if (previousPanDistanceX === 0) { previousPanDistanceX = panDistanceX; } if (previousPanDistanceY === 0) { previousPanDistanceY = panDistanceY; } this.camera.inertialPanningX -= (panDistanceX - previousPanDistanceX) / this.panningSensibility; this.camera.inertialPanningY += (panDistanceY - previousPanDistanceY) / this.panningSensibility; previousPanDistanceX = panDistanceX; previousPanDistanceY = panDistanceY; } I would be looking forward to improvements Edited June 27, 2017 by inxs GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.