Jump to content

How to limit Camera's Zoom and change it's Direction ?


Ariel Yust
 Share

Recommended Posts

camera.lowerAlphaLimit;camera.upperAlphaLimit;camera.lowerBetaLimit;camera.upperBetaLimit;

I know these guys handle the bounding angles for the camera's angles on the azimuth and elevation (took me a while finding this out!),

but how about zoom ?

 

1) I want to disable or limit the zoom on the camera (the one you have when using wheel up/down) how do I do that ?

 

2) also, how do I invert the direction that the camera moves when I drag the mouse on screen ?

 

I mean right now I hold the mouse key and drag right and the camera turns right... it should turn left, like every touch interface in the world  :P

do I need to go into babylon.js and change it manually, or is there something I don't know about ?

 

Thanks for the help !  B)

Link to comment
Share on other sites

  • 1 year later...

In case anyone else finds this while looking for a way to disable the zoom on ArcRotateCamera.
 

canvas.removeEventListener('mousewheel', camera._wheel);canvas.removeEventListener('DOMMouseScroll', camera._wheel); 

Re-adding is as simple as doing the reverse with addEventListener.

Link to comment
Share on other sites

  • 2 months later...

1) I want to disable or limit the zoom on the camera (the one you have when using wheel up/down) how do I do that ?

 

camera.lowerRadiusLimit = camera.upperRadiusLimit = camera.radius = 1;  

2) also, how do I invert the direction that the camera moves when I drag the mouse on screen ?

var camera = new BABYLON.ArcRotateCamera("Camera", 1 , Math.PI / 2, 1, BABYLON.Vector3.Zero(), scene);        camera.attachControl(canvas, true);    camera.fov = 90;//Invert rotation of the camera by dragging the mousecamera.angularSensibility = -5000;
Link to comment
Share on other sites

Hehee... I realized that today, too, when I answered on another topic that you can use a negative angular sensibility to invert the movement ... did you read the other topic or was it just a coincidence that we both find this today?  :D

Link to comment
Share on other sites

  • 2 years later...
  • 9 months later...
  • 2 years later...

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