Sign in to follow this  
Juncheng

How to touch pan the arcRorateCamera on Mobile

Recommended Posts

Hi, 

I have a question. How to touch pan the mesh in canvas?

I have a setup with an arcRotateCamera and pep.js. On the desktop, the panning with right click on mouse works fine. On the mobile, one finger rotation and pinch zoom worked, but two fingers panning is not working. I am not proficient with web developing, hope I could get some ideas from you guys. Thanks!

The code snippet for the camera:

// the camera
camera = new BABYLON.ArcRotateCamera("Camera", 1.575, 0.75, 20, BABYLON.Vector3.Zero(), scene);
camera.setPosition(initCameraPostion);
camera.setTarget(BABYLON.Vector3.Zero());
camera.inertialRadiusOffset = 0;
camera.allowUpsideDown = false;
camera.pinchPrecision = 5;
camera.wheelPrecision = 10;
camera.fov = 0.01;
	
camera.panningSensibility = 500;
camera.panningInertia = 0.1;

scene.activeCamera = camera;
scene.activeCamera.attachControl(canvas, false, false);

The code snippet for canvas and pep:

<!-- import pep.js -->
<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>

<!-- canvas -->
<canvas class="myCanvas" style="user-select: none;" id="myCanvas-Modal" touch-action="none">

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.