Zooming a camera

578
4
06-05-2023 01:25 PM
Labels (2)
ZachRuiz
New Contributor III

Hello, 

 

Can someone try and point me in the right direction in zooming a camera object? I am simulating a security camera coverage and have my pitch and zoom controls worked out but increasing the zoom as I would on an actual camera is proving to be difficult. I'm sure its easy and I am just missing it in the docs somewhere. 

0 Kudos
4 Replies
KoushikHajra
Esri Contributor

Hello @ZachRuiz Thank you for reaching out to us with your question. 

You should be able to achieve what you're trying to do using https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Mappin...

Hope this helps. If not, please let us know. 

Regards,

Koushik

 

 

0 Kudos
ZachRuiz
New Contributor III

Thanks, how can be done though when the TargetPoint is not known? The idea is simulating a camera on a fixed point that can pitch, yaw and zoom freely without a there being a specified target Point 

0 Kudos
KoushikHajra
Esri Contributor

You can use the center of the screen as the targetPoint by calling locationToScreen with the sceneView width/2 and height/2. 

0 Kudos
dotMorten_esri
Esri Notable Contributor

When you say zooming, do you really mean "move forward" ?
Traditional zooming can be done by setting the field of view on the SceneView, which matches what a zoom-lens would do (ie not moving forward, but merely reducing the FoV): https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.SceneV...

Otherwise if you want to manipulate the location of the camera, grab the Camera property on the SceneView to get the current Camera, and then use all the properties (like MoveForward) to modify the camera. See the full list here: https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Map...

Once you got the new camera you need, you can use SetViewpointCamera/SetViewpointCameraAsync to apply the new camera: https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.SceneV...

 

For a more advanced example, here's a way to control the camera using a game controller:

https://github.com/Esri/arcgis-maps-sdk-dotnet-demos/blob/main/src/KmlViewer/XInputHelper/XInputScen...

0 Kudos