Search code examples
flutterflame

Detect device orientation in flame (flutter package)


I've been following the doodle dash tutorial for flame in flutter:
https://codelabs.developers.google.com/codelabs/flutter-flame-game#0
I'd like to modify it so that the user can tip the phone left and right to move dash, rather than having on-screen buttons. However, I can't find anything in the docs which refers to an OrientationDetector or anything like it. Is there something here that I'm missing, or is this missing from flame? Thanks


Solution

  • Flame does not provide this from within the engine, to act upon such events you should use an external package like for example sensors_plus or any of the other packages that provide you with gyroscope data.