requested: through Tilt/RotationRate/Gravity/Acceleration Examples

i spend one day going through the forum and answer hub for a decent working android mobile motion sensor example, but either i missed something or there is no good examples.

it shouldn’t be that hard : implementing Tilt motion for a rolling ball for example that could work at least on all devices of one platform IOS/Android.

please if someone have a working example or reference on how to deal with motion sensors on mobile devices (Android especially) that would be really appreciated.

so i would like to suggest that:

  • we need to have a sticky post on sensor motion that could resolve most common use of motion sensors.
  • an explanation of how the BP nodes translate sensor reading ? are those reading are the same on all devices of the same platform ? how to deal with portrait and landscape mode?

thanks a lot in advance

OK, so far i managed to put together some part of the problem
before anything : (i am using UE4 4.9.2 with android 5.1.1)
the Tilt vector seems to be upside down for some reason, someone posted the solution that i can not find his name to credit him properly (sorry about that)
here is the vector correction;

after that we can apply the values to the rolling ball as in my case like following;

now we have two problems
(1st) increasing the sensitivity; for that i multiplied the corrected value by 2 so it works a bit better even though i need to put some limit to the final value so the ball will not rotate excessively(but this part i believe it is doable)
(2nd) calibrating the Tilt to the position that the tilt input would be activated; for this there is node called calibrate tilt witch is not seem to have any effect at all.

so anybody has an idea how we could tackle the sensitivity and the calibration issue ??

regards

ok it seem it is a no sleep night

thanks to this guy i think i tackled some issue;

i seems that i missed some math classes, well i am an architect not a programmer by any manner so this might be the case.
anyway:

the calibration could be done by setting tilt vector as a reference (at a moment in the game that fit you best) and check tilt rotation relative to the reference we set earlier (reference - moving tilt orientation) [be aware of the subtraction order] hehehhe that made loose an hour or two…

regarding creating a dead zone that the tilt will not be effective or least effective; that could be done through the correction function i used earlier like following:

now at least on my device (one plus one ,android ver: 5.1.1) everything looks nice the ball torque is pretty much cute, may be need a bit more polishing.

the questions that rise here are:

  • will it work on any android device?
    -is my approach is the most efficient one?
  • i read in some thread that on android acceleration should be used with android ??? but when i print screened the numbers it was crazily chaining even when i was holding the device above my head up side down…perhaps acceleration is not Accelerometer , i might be wrong…

if you might want to keep the screen on as UE4.9.2
check this solution:
https://answers.unrealengine.com/questions/330709/control-screensaver-mess-with-render.html

the tilt reading is seems to be the same as i tested with couple of android devices

Thanks for the screenshots. I’ve recently started working with these values, so if I hit a snag I’ll probably be back here referencing. For my current Play Store project, however, I’m only going to be using acceleration, so at least that narrows done some of the complexity!

Is it possible to share blue print files, instead of screen prints and re-inputing, I’m working on the same. but I would like to use it in multple examples, that’s why I would like to know is there a export or import for blueprints.

Did you ever get a template on this? if you did could you share?

Thanks sarkawt909 for all the time that you put to find all these result otherwise we all will have to spend more time on finding and leave our main goal on developing our project , and if someone found a good template that would be great .

thanks for this! may I ask: what actor or component do you have in “move reference” and also what is the tilttorqueforce value that you set?

edit* I got this working, in case anyone is wondering i am using the default rollingbpexample for mobile, and i just added a root component to the ball which is an arrow(and used that as the move reference - because you cant use the ball as a reference since it is always rotating you need something that is not going to rotate)… and as far as the torque i set it super high 5 million i think … but i did have to change some things as my tilt controls were completely flipped… the first triple multiplication thing i multipled by +1 instead of -1 as you did in the graph, and i also used the arrows right vector first, and then at the bottom part i used the arrows forward vector, that got me tilting in the correct directions…