Camera Controller - Disable Rotations in 3D View

569
4
05-17-2019 09:31 AM
SelimOzel
New Contributor III

I was wondering if there is an option to disable 3D rotations for the camera in a scene. What I eventually want to achieve is to have a 2D top-down view, where 3D rotations of the camera are not allowed and another isometric view where 3D rotations of camera are allowed.

Best,

Selim

0 Kudos
4 Replies
JamesBallard1
Esri Regular Contributor

Hi Selim Ozel‌,

    Yes, I think there should be a way to do this. Can you provide some more information so I can better understand the workflow?

For example, do you want to disable manual interactions like mouse and touch events on the SceneView, or are you just looking for something that will restrict the camera's pitch and roll?

Also, are you using the C++ or the QML Api?

SelimOzel
New Contributor III

Thanks! I am using C++, not qml. I would like to disable camera pitch motion. I want to avoid using filters for mouse clicks. Because I don't want to write code specific for each input device.

Let me know if you need more context.

0 Kudos
JamesBallard1
Esri Regular Contributor

Hi Selim Ozel‌,

   Thanks for the extra info. You shouldn't have to filter all events. Depending on what type of devices you're targeting this should work. This should cover all mouse scenarios where all the pitch and roll changes are done with the right mouse button. You can selectively discard those, as shown below.

  connect(m_sceneView, &SceneQuickView::mouseMoved, this, [this](QMouseEvent& mouseEvent)
  {
    // "accept" to throw away move events when the right button is pressed to
    // disable changing the pitch of the SceneView
    if ((mouseEvent.buttons() & Qt::RightButton) != 0)
      mouseEvent.accept();
  });

Another approach would be to consider a 2D MapView instead of the SceneView. If you want to restrict all interactions to make it appear in "2D" mode, then perhaps a Map would suffice?

We actually have a sample for doing just that. Please see here:

https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Scenes/S... 

SelimOzel
New Contributor III

Thanks again! I might actually use this in other places as well. 

0 Kudos