Jump to content

Disable certain rotation and keep panning feature


masterdon
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.  :D

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.

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...