Download

anyone know how to reduce tilt input drift?

I’m finding difficult to minimise drift without having to recalibrate constantly. Example: X axis effects the wraparound values for the Y and z axis. so after moving in a circular motion then returning to calibrated position the axis do not return 0’s and have drifted is this a bug or is there a way in blueprint to fix or compensate for this ? i am trying to achieve independent of pitch, yaw and roll to control the turn rates of a space craft. . i have tried all my brain can handle with this and would really appreciate some advice please.

thanks Alan

It’s not possible, AFAIK. Gyroscopes will drift, it’s unavoidable. You cannot get a reliable global direction from them. You’d need to use the camera in some way to track external reference landmarks to correct the drift. It should also be possible to use the compass to help with yaw drifting.

thanks pedro, i understand there will always be some drift / inaccuracy but after one circular movement the pitch and yaw can be out by as much as 10-15 degrees (using the blueprint nodes get motion input).
I’ve found a file in me projects IOSInputInterface.cpp which from what i can tell gets pitch roll and yaw from CMAttitude and after much google reading up I’m led to believe that more accurate results can be obtained using a quaternion from Attitude wit a bit of math to calculate pitch yaw and roll from axis x,y,z and w.
I’ve been trying but I’m not competent with code and don’t know how to implement this correctly to get these input values into my Blueprint projects.
again any advice is very much appreciated.

Thanks,

Alan

I’ve checked your game and have been doing some tests and you shouldn’t be getting that much drift. The whole calculation is done by the iOS SDK, UE4 just forwards the numbers to blueprint.

How are you reading input in your blueprints and applying the values for movement? I tested using the “Tilt” key input, which contains the Attitude’s yaw, roll and pitch in radians. At worst got a little under 2 degrees of drift on roll. For your game you should read the tilt Y (roll) and Z (pitch) and perform a deadzone check (ignore absolute values below ~2 degrees) before using them to move the ship.

thanks for your time pedro, ill be so happy if I’m doing it all wrong and it can be fixed.
Overview.jpgTilt Input.jpgset pitch.jpgYaw.jpgRoll.jpg

Alright, a few things.

  1. Tilt X is the iPhone yaw, tilt Y is the iPhone **roll **and tilt Z is the iPhone pitch. So you should unplug the pin from the Tilt X (which connects to “set pitch speed” and plug it into Tilt Z instead. You shouldn’t be using the tilt X at all unless you’re doing some sort of VR application or motion based panorama viewer where the user turns around his/her own body.

  2. You need to apply some deadzone calculations to the tilt values before using them in order to create a “no move” tilt area to absorb the drift. Right now it’s impossible to keep the ship flying straight since you need to keep the device in a very specific position (which changes slightly over time due to drift). I prepared an example of how to do this, just paste it into your blueprint: http://pastebin.com/izDaJpk8