masterdon Posted June 6, 2017 Share Posted June 6, 2017 I have used below code to disable rotation. camera1.inputs.attached['pointers'].detachControl(canvas); This removes all pointers events. 1) However i would like to only remove rotation feature only. and click + drag should be binded for panning feature(which is on cntrl+click+drag now) 2) how can extend the control keys for zoom and panning feature. i was hoping to implement something like this: A : Pan left D : Pan right W : pan front S : pan back And also over Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 6, 2017 Share Posted June 6, 2017 Hi M. Sure, you can hack camera inputs and set alpha limits on arcRotateCamera... it's all good fun. You can X/Z "slew" an arcRotate position and its target... at the same time... and the same distance (always keeping target straight-ahead of camera). (perfect overhead orthogonal view) But what if... ...you created a box right in front of your camera. Now make your keypresses... rotate and move THAT box... AS IF it were a camera. Get super-full-control of the box, with keypresses. And then... set the box.visibility = 0; and camera.parent = box; The world famous 'camera gizmo' method. Your keypresses control the invisible robot (the box), and the robot is holding your camera. Might work, huh? Sometimes, you need to wipe the camera.keys array, though. Or maybe, don't attach camera to canvas. All in all, once you can move-around a box with keypresses, then your parented camera will move exactly the same. Perhaps easier than building a custom camera input. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 7, 2017 Share Posted June 7, 2017 http://www.babylonjs-playground.com/#SUXKHY#16 There's a playground with an arcCam... with locked alpha and beta, and target directly beneath cam... perfect -Y view. Lines 116-117... goofy numbers. Ok, it is ALMOST perfectly -Y aimed camera. Lines 118-121... limit the arcCam alpha and beta (essentially, disabled). Line 122... attach canvas... so mousewheel and control-drag still works. Lines 138-163... activate wasd keys that move cam position and target SAME amounts (always keep target directly beneath cam). Pretty close to what you want? Hope so. Something to play-with, anyway. masterdon and GameMonetize 1 1 Quote Link to comment Share on other sites More sharing options...
masterdon Posted June 7, 2017 Author Share Posted June 7, 2017 Wow. exactly what we want. Ill write the code to make it work on drag(without cntl click) now. Thanks a lot...As always nailing it . I am making good progress on planner..using mesh approach as suggested by you. instead of canvas2d. Will update you soon. Wingnut and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.