Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vibrate using iOS haptics engine on supported devices #60397

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

timoschwarzer
Copy link
Contributor

This PR uses the CHHapticEngine (https://developer.apple.com/documentation/corehaptics) API on iOS devices with iOS 13+ for vibration, making it possible to play vibration patterns of arbitrary length like on Android. Currently, it is not possible to play a vibration with a specific length on iOS.

Additionally, this PR exposes methods to query Haptic Engine support and to manually start and stop the Haptic Engine instance. This is useful in applications where there must not be any latency when playing the first vibration. By default, the Haptic Engine instance is set to automatically start and stop on demand, which could induce a minimal delay on the first vibration according to the docs.

@timoschwarzer
Copy link
Contributor Author

TODO: Change the hint for Input.vibrate_handheld in the docs

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't test on a device, but code seems fine.

@akien-mga akien-mga merged commit 8a996d7 into godotengine:master Apr 27, 2022
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

akien-mga commented Apr 27, 2022

Ah I forgot about the TODO before merging - I'll update it.

Edit: Done with 74ae1ec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants