donderdag 18 augustus 2016

Reboot after reboot continued

If you got through the crap I wrote in the other part, you will most likely make it through this one.

I am currently working on getting the hang of x and z axis. Why x and z and not x and y? Because I don't want to move up, but to the left and right and forward and back. Though I agree the translation of these vectors can be arbitrary, I like to keep it straight forward.

So, what was the deal? Well, the default code in the 'Rollerball' prefab object script, was not intended to get the accelerometer info from an Android machine.

I added:
(h and v were the originally created variables, which I left unchanged)
float h = Input.Acceleration.x;float v = Input.Acceleration.z;
(Bear with me, I have no clue yet, which axis will be more correct for which direction).

It works, but now I needed to adjust the cam, because everytime the stuff rolled of the screen (though this might have been because I replaced the original code for actually moving the ball, by:
Transform.Translate(v,0,h);

Geen opmerkingen:

Een reactie posten