CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
347 stars 83 forks source link

Support custom input actions on `CesiumCameraController` #425

Closed azrogers closed 7 months ago

azrogers commented 7 months ago

Fixes #414.

This change adds a set of properties to CesiumCameraController that allows specifying an input action to bind to each action in the camera controller (such as look, move, speed change, etc). This property can specifying a binding for that action, or reference an existing action to use for the input. If no action is specified, CesiumCameraController will create default bindings for that action as it did before this change.

csciguy8 commented 7 months ago

@azrogers One more thing, do you think you can document this new functionality in Changes.md?

Users would be interested to know about it. Thanks!

azrogers commented 7 months ago

Updated CHANGES.md. In response to your two questions:

  1. InputActionProperty allows the same UI as InputAction, with the addition of allowing InputActionReference assets to be specified in place of a new binding. So I think the name "Input Actions" is still accurate, it will work the same as an InputAction if you want to use it that way.
  2. I don't think the InputActionProperty fields can be set with field initializers. Could possibly be set through the Reset method in the editor? But I don't think Reset runs on existing components, only when you add a new component to the scene, so any camera controllers in scenes people already made before this change would stop working. So we'd need some way of setting these default values on components already added to scenes too.