Jump to content

Change ArcRotateCamera default behavior


Rodrico
 Share

Recommended Posts

Hi folks,

I'm using ArcRotateCamera attached to my scene which default behavior is

1) MouseClick+Drag changes .alpha and .beta
2) Ctrl+MouseClick+Drag changes camera.position
3) MiddleMouseClick+Drag changes .alpha and .beta

I'd like to know whether there is some way how to switch behavior of 1) and 2) so with ctrl+drag and/or middle+drag it rotates and with simple click+drag it moves camera.position, or should I add handlers on mouse events?

Thanks for your ideas.

Link to comment
Share on other sites

Hello out of the box this is not supported but easy to do :)

This file controls the mouseclicks + drag:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

and more precisely here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts#L97

More about inputs:http://doc.babylonjs.com/tutorials/customizing_camera_inputs

 

Other option is to do what you said: do not call camera.attachControl and just handle the mouse events.

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