How can I use Android tablets tilt through blueprint?
How does one go about mapping the Accelerometer and Gyro from a tablet using Blueprints? I have an actor that I would like to rotate using the accelerometer (I believe). My project already ports to the android fine, now I'm just trying to start using the inputs from the tablet. Would this be better to do in code right now?
asked Jun 09 '15 at 09:14 PM in Blueprint Scripting
Here, check this out, you may find it helpful :)
answered Sep 18 '15 at 07:52 PM
No code needed. You can use Get Player Controller > Get Input Motion State, and use those outputs for some nodes like Set World Rotation or Set Relative Location. Fire those nodes with Tick or a Timeline. I recommend a Timeline so you can control when it's firing and keep it in its own little node network without having to attach it to Tick. I think Tick is icky and never needed in BPs.
Also, I found that Android tilt can be janky. So here's my agony-saving tip for you:
Use Gravity from Get Input Motion State. With Rotation Rate, use Break Vector and check if Y (or whatever your primary axis will be, but probably Y; same for your Gravity output) is between -.1 and .1. If so, round your Gravity Y value to the nearest 10th. Otherwise, leave it be. This essentially detects if the player is "trying" to steady their aim, and smooths it. When they aren't it lets it move naturally.
After some real heartache, this boosted our game's playability hugely, as it relies heavily on aiming with tilt.
Hope that helps you out :)
Sorry for resurrecting this post. I'm working with a project using tilt, and can't get it to respond on the testing device. Could you possibly show the BP that worked?
answered Dec 13 '17 at 07:37 PM
Hi! Sorry for the third resurrection but I am struggling with the same issue too so any BP demonstration would come more than handy!
answered Jan 23 '19 at 12:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here