A free skill for adding gyroscope and accelerometer motion controls (tilt, shake) to an Unreal Engine 5 Android game, with the sensor quirks we hit along the way.
We make a touch RTS for phones. Last week we gave it motion orders: tilt the phone to the right and your armor rolls forward, tilt it left and everyone stops, shake it and your units pick new targets. Sounds like an afternoon. It wasn’t.
The sensors are easy to read and easy to get wrong. The gyro is silent unless one project setting is on, and it fails without an error. The axis you get depends on the display rotation, and the sign depends on which landscape the player holds. A shake looks exactly like a tilt for the first few samples. We guessed, built, tested on a phone, guessed again. So I wrote down what we learned as a Claude Code skill, the same way I did for shipping to the stores. It’s free, MIT.
What’s inside
- What the engine really does to Android sensor data on 5.8: RotationRate is the raw gyro in the device frame, Gravity is a filtered accelerometer, and what the legacy remap changes in each landscape. With file and line references, so you can check me.
- A detection recipe that worked for us: a fixed-rate timer instead of Tick, a threshold with consecutive samples, a short pending window, a cooldown, and a cancel rule so a shake never fires a tilt first. Starting numbers included, marked as starting numbers.
- The one rule I wish we had from day one: make the axis index and the sign class-default tunables and print one log line when a threshold is crossed. We changed the axis twice in one morning. Both times it was a defaults edit, not a rebuild.
- Feedback: a caption that names the order and a short haptic pulse when it registers.
- A test you can run without a phone: a scripted sensor feed in PIE with expected results per stage. Then the phone pass with adb logcat, and a checklist to get the debug code out again.
- A Blueprint pseudo-graph and a C++ version of the detector.
Things we got wrong, so you don’t have to
- Allow IMU Sampling was off. Every motion read returned zeros. No warning anywhere.
- We hard-coded the axis. Then we found out roll about the screen is the same in both landscapes, but pitch is not.
- Our first “tilt” detector fired on shakes. Linear acceleration tells them apart.
- We judged the feel after one match. Our own tester called it unintuitive, asked for the other axis, then went back to the first one after a few matches and liked it. Give it time before you change it.
It is being actively developed
This is v0.1, written from one game and one week of phone tests. We are still tuning it: the haptic pulse and the pitch variant are in the repo but not confirmed on hardware yet, and the next builds will change numbers. If you use it, check the repo for updates now and then, or watch it. Corrections from people who have done this on more devices are very welcome. Open an issue, I read them.
How it works
Nothing runs on its own. Your Claude Code agent reads the skill, checks your project for the prerequisites, builds the detector with the tunables and the log line, runs the PIE feed, and then you tune on a phone. Tested on UE 5.8 with Blueprints. Items marked “verify” depend on your engine version or phone.
The two earlier skills, if useful: GitHub - alexglonti/ue5-mobile-shipping: Ship Unreal Engine 5 mobile games to Google Play and the App Store from one Windows PC + a Mac mini, with Claude Code agents. A Claude Code skill by Alex Glonti / Nomad Devs. · GitHub (shipping to Google Play and the App Store) and GitHub - alexglonti/agentic-government: Agentic Government: a Claude Code skill where a manager model delegates to cheaper or stronger worker models by task difficulty, a checker verifies before anything counts as done, and a ledger measures cost and rework. By Alex Glonti / Nomad Devs. · GitHub (a manager model delegating to cheaper or stronger workers).
Alex Glonti, Nomad Devs
