Jump to content

Panning and support for click event on line in Babylon.js


dbs2000
 Share

Recommended Posts

31 minutes ago, Luaacro said:

so we can have an option to activate only panning or zooming ? Two fingers are already used to zoom if I'm not wrong

You don't need to distinguish between zoom and panning. In my own camera implementation i also use two fingers for both simultaneously.
It works very well. I use the center of the two fingers as the panning point and distance between the two fingers for the zoom.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

I tried to implement this.  I edited the ArcRotateCameraPointersInput code to try and get 2-finger touch to pan.  It kinda works but for some reason I can't change direction whilst the fingers are down.  Also, it gets tricky trying to distinguish between pan and zoom.  Any tips to make this work better?

My code is here http://www.babylonjs-playground.com/#RQJ38#2

Search for "I EDITED THIS PART" to get to the code that I added.

Link to comment
Share on other sites

Hello,

Always interested by this implementation ! I need it too. I woukd like to help, but I'm not sure I can... I'm going to play with your playground

After a new reading of the topic, it seems that @Kesshi has already worked on it. Maybe if he reads this, he could help us.

 

Link to comment
Share on other sites

@ViBe Yes i sovled that problem for this project:

You can try it on a touch device. But i can't publish the code because its a commercial project ( but in the end its javascript, so ... ;) ).
Its also not so easy to give you some code snippets because i don't rely on any input/event handling from BabylonJs. I implemented my own solution which directly controls a plain BABYLON.TargetCamera.
@ozRocker There is no need to distinguish between zoom and panning. You should perform/calculate both at the same time. If the user doesn't change the distance between the fingers while moving them, no zoom will happen only the panning. Atleast this is what i'm doing in my project.

Link to comment
Share on other sites

2 hours ago, Kesshi said:

@ViBe Yes i sovled that problem for this project:

You can try it on a touch device. But i can't publish the code because its a commercial project ( but in the end its javascript, so ... ;) ).
Its also not so easy to give you some code snippets because i don't rely on any input/event handling from BabylonJs. I implemented my own solution which directly controls a plain BABYLON.TargetCamera.
@ozRocker There is no need to distinguish between zoom and panning. You should perform/calculate both at the same time. If the user doesn't change the distance between the fingers while moving them, no zoom will happen only the panning. Atleast this is what i'm doing in my project.

Thanks for the tip!  I altered my previous playground

http://www.babylonjs-playground.com/#RQJ38#3

The panning is better here.  I just need to make it work with zoom.  I think zoom is too sensitive on touch devices.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...