PlayMaker Help & Tips > PlayMaker Help

[SOLVED] Invert Accelerometer

(1/1)

Horror:
Hey!

I'm trying to apply what I learned in the Acceleration video tutorial to a camera view so I can look around using the accelerometer on my device. Tilt to the left should rotate the object clockwise, right for anti-clockwise.

This works fine for rotating an object that you are looking at, but if you are the object being rotated then tilting to the left will make you look right and vise versa.

I'm guessing I have to convert the Y float variable from the device to a negative equivalent and update it every frame? I've tried creating an additional variable, setting its Y value to the value of the global variable taken from the device and then using an Abs to convert it every frame. That didn't work, though... the result is probably being stomped every time the device updates.

Any ideas as to how I should go about this? I know I'm going to punch myself when I hear the answer!

jeanfabre:
Hi,

 It's hard to tell like this, but yes, you should get the acceleration value and the next action must be a float multiply that multiply by -1.

 if that's not the case, then it might simply be a problem of rig set up and transform.

 I suggest the following. take control of the value yourself without the accelerometer, and see how the cube is behaving. if it behaves find, either you are mis interpreting the accelerometer value or something is odd in the process. you can do that with a joystick for example, or simply with the keyboard.

Also, do you have some debug tools to watch the values of the accelerometer, so that you are actually sure about the outputs, this does help a lot as well.

Bye,

 Jean

Horror:
Awesome! That did the job.

Thanks Jean!

Navigation

[0] Message Index

Go to full version