Reputation: 14848
I have been making this app, if you click the top left tab it will show the assistant cube and then click and drag your mouse around the screen to move the camera with the trackBallControls. If you rotate the camera off to one side and then click the top left tab again to hide the assistant cube it should go back to focusing on the board, which it does but it is rotated at an odd angle.
Is there any part of the trackBallControls api that allows for the rotating of the camera? Currently I animate the camera back to centre and zero rotation but after the rotation animation has finished the trackBallControls takes over again and snaps it out of alignment, which is unwanted and I can't see any obvious way of controlling rotation from the control api.
Upvotes: 1
Views: 6954
Reputation: 104763
No. There is no part of TrackballControls
that constrains the rotation of the camera.
TrackballControls
is really the wrong control for your purposes. This is why you are not liking it. Try OrbitControls
, which will keep the puzzle "right side up" -- plus the code is easy to understand.
Personally, I would do as you say, and write your own controls. IMHO, the camera does not need to move vertically within the assistant -- just in a circle horizontally.
In any event, Congratulations! Nice looking app. :-)
Upvotes: 1
Reputation: 1999
You can modify the code of this.rotateCamera()
in TrackballControls.js
.
Upvotes: 0