playMaker

Author Topic: Ye olde 'calibrate tilt' question  (Read 3319 times)

markinjapan

  • Full Member
  • ***
  • Posts: 103
Ye olde 'calibrate tilt' question
« on: November 24, 2012, 02:19:26 PM »
Hi, I've been trying to get this to work:

http://hutonggames.com/playmakerforum/index.php?topic=1922.0

But with no success :(

Basically, I need the same thing, I want to calibrate my device so that the device doesn't have to be held flat in order to work.

Wondering if anyone can make a example package? Or even explain it in a little more detail?

Thanks in advance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Ye olde 'calibrate tilt' question
« Reply #1 on: November 27, 2012, 12:35:23 AM »
Hi,

 How do you intend to use the gyroscop? Device roll action did it for me.
https://hutonggames.fogbugz.com/default.asp?W575

bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Ye olde 'calibrate tilt' question
« Reply #2 on: November 27, 2012, 03:49:03 AM »
Hi,

I'm using the Get Device Acceleration action. Is Roll just for the Z angle? Would be nice to have something similar in the Get Device Acceleration action where you could define a 'base vector', the angle at which the user would hold the device comfortably and that would be the neutral point (instead of flat always being the neutral point, 0, 0, -1).

Thanks

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Ye olde 'calibrate tilt' question
« Reply #3 on: December 04, 2012, 12:30:43 PM »
Hi,

Just thought I'd update this in case anyone else was stuck on how to do this.

In the end I figured out a better way to do it. Basically, I just take the vectors from each axis (actually, I only needed 2) and then use the 'Sample Curve' action to plot them against a Euler angle range (in my case -45 to 45 but I can easily change that it the user needs a tighter/looser feel). So I'm just changing the normalised values I get out of the Get Device Accel. into actual angles. Then I put the results in to a Vector3, apply a low pass filter (otherwise it's very jerky) and put into iTween Rotate Update (with the Camera attached to that).

Added bonuses are that the view is automatically clamped and (if you use curves in the Sample Curve graph) automatically eased when you get close to the clamp position.

If anyone needs any help with this let me know.

Mark

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Ye olde 'calibrate tilt' question
« Reply #4 on: December 06, 2012, 05:52:39 AM »
Hi Mark, can you post a screen grab of your set up please? Specifically the Sample Curve action.

Thanks

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Ye olde 'calibrate tilt' question
« Reply #5 on: December 08, 2012, 01:16:19 PM »
Sure, here you go.

So, to explain the Sample Curve, a comfortable postion to hold the device is at Vector X -0.50 (landscape left). So I have a range of -0.60 to -0.40 which means I only rotate the device very slightly to change from -0.60 to -0.40.

(Note to Jean or Alex, would be great if we could type these numbers in, very fiddly :) )

And then I just want my camera to rotate to min -25 degrees, to max 25 degrees. So graph coords are -0.60, -25 to 0.40, 25.

And then do the same thing for the left and right. I just output the Get device accel vectors and round them and note down the rangle I need (in my case -0.8 to 0.8).

Calibration shouldn't be a problem but would be a lot easier if you could type in vector 2 variables into the Sample Curve action so they could be dynamic.

Mark

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Ye olde 'calibrate tilt' question
« Reply #6 on: December 09, 2012, 04:57:06 AM »
Thanks, I didn't know about the sample curve action, looks very useful.  ;D