x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.7
Tags:
more ▼

asked Jun 09 '15 at 09:14 PM in Blueprint Scripting

avatar image

Thumper
966 143 150 390

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

5 answers: sort voted first
more ▼

answered Sep 18 '15 at 07:52 PM

avatar image

dr.purple
101 2 2 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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 :)

more ▼

answered Jun 09 '15 at 09:24 PM

avatar image

DG Gage
1.7k 62 31 129

avatar image Thumper Jun 09 '15 at 11:47 PM

Awesome thanks. I've got it responding to my tablet now. I still need to calibrate it. Any recommendations for that. Currently my direction indicator is wiggling a good deal (and in the wrong directions) so I was wondering if there is an easy way to iron out the remaining calibrations. For instance, I can't tell right now if the tablet is able to influence inside of Unreal for debugging. But when I ported it to the tablet and ran it I could see the indicator moving back and forth as I did with the tablets tilt. So I know it's on track but I need to adjust how it's being told to rotate and so on. Is it just a dial in and build situation?

avatar image DG Gage Jun 10 '15 at 12:02 AM

You'll have to study the experience as if you were a player. Use Print Strings with those Get Input Motion State values. How far should you have to tilt left or right? You'll multiply your Gravity Y by some value to perfect that, and use Branches to monitor hard limits (ex. never rotate more than 70 degrees left or right). You'll also study Rotation Rate, determining within what range is a player trying to steadily aim.

Unfortunately, the only to do this is to keep building it onto your Android device in development with those Print Strings, make changes in the engine, repeat. Real-world note-taking is recommended :)

But with this finalized method (I've destroyed myself with several other less-effeftive and massively more complex methods), that's really the extent of work that was necessary to achieve good gameplay. It'll never be as good as iOS, but that's just a difference in hardware.

PS. Feel free to also mess around with value smoothing outside of the Rotation Rate aim check, if you feel it's necessary.

avatar image DG Gage Jun 10 '15 at 02:41 AM

Do you want more info on this or are you ready to roll? I ask for tracking purposes, so we can close the question or not.

Totally happy to give you as much help as you want :)

avatar image Thumper Jun 10 '15 at 02:57 AM

Thank you, I'm good with this part. I've got input coming in, just gotta do the work now. I'll toggle the answer.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey bro , Can you show me the Blueprint ? I'm doing it too :)

more ▼

answered Oct 24 '16 at 08:09 AM

avatar image

逗你玩
6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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?

more ▼

answered Dec 13 '17 at 07:37 PM

avatar image

TrayJ
13 1 2 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi! Sorry for the third resurrection but I am struggling with the same issue too so any BP demonstration would come more than handy!

more ▼

answered Jan 23 '19 at 12:45 PM

avatar image

TheoT
48 6 9 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question