playMaker

Author Topic: iOS Device Acceleration Tutorial Help - all directions 90 deg  (Read 6663 times)

painkillers

  • Playmaker Newbie
  • *
  • Posts: 3
iOS Device Acceleration Tutorial Help - all directions 90 deg
« on: February 18, 2013, 06:03:20 PM »
Hi All - looking for some help on the device acceleration tutorial or my general setup.  I've followed the device acceleration tutorial for the marble game but when I build either my scene or Chris' scene my directions are off, such as:

*Tilt device forward -> marble to goes right
*Tilt device back -> marble to goes left
*Tilt device right -> marble goes forward
*Tilt device left -> marble goes backward

If someone has any insight on this, I would really appreciate it.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #1 on: February 20, 2013, 01:42:39 AM »
At a guess you have your device orientation (found in player prefs) set to the wrong orientation.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #2 on: February 21, 2013, 12:48:28 AM »
Hi,

 The problem with expecting the user to hold the device in a certain orientation is that it's hardly ever the case... but I have yet to find a useful library or script that does device orientation properly and reliably, so if anyone knows a script or a tool, I will be glad to port it in playmaker if reliable.

bye,

 Jean

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #3 on: February 21, 2013, 03:43:28 AM »
Modern flying games use a calibrate button,once you have your position press calibrate then it will zero out the accelerometer.

painkillers

  • Playmaker Newbie
  • *
  • Posts: 3
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #4 on: February 24, 2013, 09:22:15 AM »
Hi Guys,

Thanks for the insight.  To clarify, I had device orientation locked to Landscape Right which is why it was really troublesome.  However, I was able to get it working by manipulating the math a bit.  I had to multiply the Y acceleration by a negative number, map the Y acceleration to the X vector and X acceleration to the Z vector.

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #5 on: February 25, 2013, 04:51:15 AM »
Hi painkillers
Any chance you could share your layout as I had problems working out how to transform the accelerometer movement to the planes movement,I thought to store the movement from the accelerometer movement in a vector 3 then use set rotation using the vector 3 but that didn't work.

painkillers

  • Playmaker Newbie
  • *
  • Posts: 3
Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
« Reply #6 on: March 02, 2013, 12:16:58 AM »
Hey Gamedivision,

Sorry for the delay.  Unity and Playmaker are my weekend hobby.  Here's how I setup my scene.  I hope this helps.



« Last Edit: March 02, 2013, 12:20:12 AM by painkillers »