x


How to offset Input.Acceleration by 90 degrees

I' ve been messing around with the StarTrooper example. In the example it assumes that the device is flat (paralell to the ground). I'm wonder how I would go about changing it so that it assumes you are holding it perpendicular to the ground. I tried changing

var accelerator : Vector3 = Input.acceleration;

if (horizontalOrientation)
{
    var t : float = accelerator.x;
    accelerator.x = -accelerator.y;
    accelerator.y = t;
}

to

var accelerator : Vector3 = Input.acceleration;

if (horizontalOrientation)
{
    var t : float = accelerator.x;
    accelerator.x = -accelerator.y;
    accelerator.y = t+.90;
}

I though offsetting it by 90 degrees would work, but it behaves strangely. Any ideas>

more ▼

asked May 22 '12 at 04:03 PM

testerthetester gravatar image

testerthetester
0 1 1 1

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x953
x195
x97

asked: May 22 '12 at 04:03 PM

Seen: 592 times

Last Updated: May 22 '12 at 04:03 PM