How can i make orbitcontrol rotate my group in all directions without limitation

I am trying to rotate this volume from right to left using my mouse and dragging it from right to left. But my group object spins along the z access as follows:

But what i really want is to rotate along the y access as follows:

Hopefully you get my question. I tried playing with these variables as well:

            controls.minPolarAngle = 0; // radians
           controls.maxPolarAngle = Math.PI; // radians
           controls.minAzimuthAngle = -Infinity; // radians
           controls.maxAzimuthAngle = Infinity; // radians

But it is not working. Any one has any ideas?
Thanks

  1. OrbitControls don’t rotate the objects in the scene. They only rotate the camera, ie. they orbit the camera around its target.
  2. OrbitControls make an assumption that camera cannot go upside-down. If that’s what you’re looking for, you can go for TrackballControls instead.
2 Likes

Hi @mjurczyk

Thanks for the suggestion. I did try TrackBallcontrol but that totally freezes in this page and does not even let m e rotate or do anything with the mesh. Not sure what the issue is since it does not give any errorrs. Mind you i have used TrackballControl in other codes so i am familiar with it. But it totally freezes in this particular page. Now I also have seen Orbitcontrol rotate in all directions in my other pages, so I am not sure if you always need to use Trackball control for rotating to left and right or up and down. At this point I am frankly stumped for a solution here.

Take a look on the code of this example: three.js examples

Maybe this can help you figure out a solution.

Thanks @iHast. Appreciate the info. I finally solved the problem by taking the following statement out:
camera.up.set( 0, 0, 1 );

This was causing the camera not to rotate properly along the y access when moving the mouse from right to left.

2 Likes

Glad you figured it out! Can you mark your post as solved? It helps us stay on top of questions.

1 Like