Playmaker Forum

PlayMaker Help & Tips => iOS Help => Topic started by: painkillers on February 18, 2013, 06:03:20 PM

Title: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: painkillers 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.
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: escpodgames 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.
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: jeanfabre 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
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: gamedivision 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.
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: painkillers 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.
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: gamedivision 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.
Title: Re: iOS Device Acceleration Tutorial Help - all directions 90 deg
Post by: painkillers 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.