Christine H.
Christine H.

Reputation: 163

Can I make dice rolling with gyroscope in React Native?

So, the idea is that there are several dice on the screen and the user needs to shake their phone to roll the dice (or push a button in case they don't have a gyroscope in their phone). The dice should be banging on the screen "walls" like they're in a box or something. At the end all the dice stop on one of their sides. Is there ANY way it can be accomplished with pure React Native/Expo? Any advice is appreciated. And if this one is impossible, can the user at least press the button for the dice to start rolling on the screen?

Upvotes: 1

Views: 792

Answers (1)

Dani Gee
Dani Gee

Reputation: 413

You can use the sensors using:

https://github.com/react-native-sensors/react-native-sensors

or if you are using Expo:

https://docs.expo.io/versions/latest/sdk/gyroscope/

Upvotes: 0

Related Questions