0

Right now the whole the scene is rotating when moving the scene to left/right/top/bottom. I want to drag it in four directions.

http://arkatest.com/bbmap/map/test1.html

http://pastebin.com/KqQe1LhL

gman
  • 100,619
  • 31
  • 269
  • 393
mahadev s
  • 51
  • 2
  • 8
  • 1
    I would recommend staying away from THREEx extensions unless you're truly doing something that can't be done with Three.js alone that THREEx is solving. THREEx hasn't been updated in 2 years. Three.js is in Alpha and release sensitive. Instead, check out the examples folder which contains many controls examples that you can use right away: https://github.com/mrdoob/three.js/tree/dev/examples/js/controls See specifically OrbitControls and TrackBallControls. There's a very simple example here: https://codepen.io/nireno/pen/cAoGI – Radio Jul 26 '16 at 15:55
  • 1
    From the SO guidelines: *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. * – gman Jul 26 '16 at 17:30
  • 1
    yeah i took the help of trackball controls and it worked perfectly @Radio – mahadev s Jul 29 '16 at 09:24
  • sure next time i will @gman – mahadev s Jul 29 '16 at 09:24

1 Answers1

0

You are using the trackballcontrols to manipulate the camera movement. The trackballcontrols has a pan functionality but it is triggered when right clicking with a mouse. This functionality is not configurable.

A very quick hack to enforce this would be changing this line to

_state = STATE.PAN;

A better way would be to create a PR to three.js to make this mouse inputs configurable.

Gero3
  • 2,817
  • 1
  • 22
  • 21
  • This works perfectly what i expected to do..! Thank You. – mahadev s Jul 27 '16 at 07:25
  • how to expect the same behavior with touch events @gero3 – mahadev s Jul 27 '16 at 13:13
  • remove this code https://github.com/mrdoob/three.js/blob/dev/examples/js/controls/TrackballControls.js#L504-L508 – Gero3 Jul 27 '16 at 14:47
  • when i removed that code, the moment i touched the screen the scene is getting disappeared @gero3 – mahadev s Jul 28 '16 at 06:11
  • i implemented one fingered touch pan and its working now @gero3 – mahadev s Jul 29 '16 at 08:06
  • how to limit the scene pan to screen size so that it will not move beyond the scene.? @Radio – mahadev s Jul 29 '16 at 11:46
  • @mahadevs - I am not quite sure what you mean. it may be a new question. However, this may be useful: http://stackoverflow.com/questions/10858599/how-to-determine-if-plane-is-in-three-js-camera-frustum as soon as the center of the scene is out of frustrum, disable the pan controls with controls.noPan. – Radio Jul 29 '16 at 21:59