Kreeba Posted August 18, 2017 Share Posted August 18, 2017 What is the best practice in picking up this gesture, and infact gestures in general? I know that the Pinch-to-zoom is already implemented as the sorta camera radius increase/decrease on the universal and touch camera, however I want to use the gesture on an orthographic camera, so need to pick up the event. How? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 21, 2017 Share Posted August 21, 2017 Hey unfortunately there is no direct support for pinch/zoom gesture event on the web You can have a look here to understand how I do it for the arcRotateCamera: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts#L115 Basically, based on evt.pointerId, I capture position of first two pointers and then compute the distance between both Wingnut 1 Quote Link to comment Share on other sites More sharing options...
UeliUeli Posted November 19, 2018 Share Posted November 19, 2018 Hi There I try to manipulate the pinch-zoom and panning gesture of the arc rotating camera, but the two arguments from the doc don't seem to change the behavier. Do you have any idea what could be wrong? The problem is: The cameras pinch function is too slow... Quote // Parameters: alpha, beta, radius, target position, scene var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 5, new BABYLON.Vector3(-1300,0,2700), scene); // Positions the camera overwriting alpha, beta, radius (LeftOrRight,UpOrDown,ForwardOrBackward)) camera.setPosition(new BABYLON.Vector3(-1300,0,2700)); //set target camera.setTarget(BABYLON.Vector3.Zero()); // This attaches the camera to the canvas, prevent default and tels it what button is used for panning camera.attachControl(canvas, false, false, 2); //limit angle camera.lowerBetaLimit = 0.1; camera.upperBetaLimit = (Math.PI / 2) * 1.1; camera.lowerRadiusLimit = 20; camera.upperRadiusLimit = 4500; //sensitivity camera.angularSensibilityX = 4100; camera.angularSensibilityY = 6500; camera.panningSensibility = 100; //camera.speed = 0.5; camera.pinchPrecision = 60.0; camera.pinchDeltaPercentage = 800; scene.activeCamera = camera; Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 19, 2018 Share Posted November 19, 2018 pinchPrecision or pinchDeltaPrecision is the way to go: https://playground.babylonjs.com/#J5RFQP vs https://playground.babylonjs.com/#J5RFQP#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.