Control Cesium Camera With Gamepad October_2021

Hello, I’m simply trying to find new ways to control the camera in my Cesium App. I have a number of gamepads/joysticks/spacemice that work with gamepad API currently giving values into the https://gamepad-tester.com/ but have no way to have them link up to Cesium’s camera system. I realize there is old code from the user Hyper Sonic on this forum and have fiddled with it before but it seems unsupported/out of date, and I was wondering what the current status for doing this is in 2021. I am aware of how to use the keyboard wsad sandcastle example to work with the camera, if there is any example of what to code to enable the gamepad joysticks to control the Cesium camera that would be awesome for pan and zoom and other movement that would be great to see. Thank you,

MH

@mhernandez624

Thank you for sharing some details about your project with the community! Quite frankly, I love this idea :grinning: I am looking forward to seeing how this progresses. If all goes well we might even feature this in a blog post.

To be candid, I do not have experience using the gamepad API that you are referring to. I can, however, point you to some camera-related CesiumJS resources. I recommend you start by looking through our Camera documentation.

https://cesium.com/learn/cesiumjs/ref-doc/Camera.html?classFilter=camer

As you can see, there are a variety of relevant members such as direction, heading, position, etc. that can be updated at runtime. I suggest you start by updating these variables based upon the controller input captured by the gamepad API. Let me know if you have any other questions or concerns! Looking forward to learning more about your project.

-Sam