zaterdag 20 augustus 2016

Step by step

Okay, so what are we trying to fix up now?

I want to know exactly the positioning of the device. So, I have already created a Unity3D project, where the position of device transforms the position of a gameobject that represents the device.

Now, I want it to show exactly on screen the position of the device.

I know that using the clear line:

{axis} = Input.acceleration.{axis};

Is not going to work, because of the way the accelerometer works. It will never be 0 exactly, so it will keep the object moving and moving.

But with a normalization or rounding it might work.

Well, look at that...As I expected, I should use the Gyroscope (as I have done in libGDX), but Unity's documentation seems a bit obscure on this part.

I now use:
transform.rotation = Input.gyro.attitude;

It works, but for some reason the device is already not flat.....weird...ah...wait...
It is because of the axis are transformed to the gameObject, which then works with different axis....
I have now put it 'north', causing the Z axis to be 0 and the object is 'laying flat'. I already noticed this exact same issue when using the acceleration method. Z and X are inversed.

So, now how to get the right stuff from the gyroscope...which is a ...quaterion..

okay, fixed it:
transform.Rotate (-Input.gyro.rotationRate.x, -Input.gyro.rotationRate.z, -Input.gyro.rotationRate.y);

The - signs are used to counter the fact that the device is moving in negative angles.

Gonna use:
https://www.youtube.com/watch?v=tCnuwkmC7BU
https://youtu.be/tCnuwkmC7BU
https://ralphbarbagallo.com/2013/02/19/displaying-maps-in-unity3d/
http://staticmapmaker.com/mapbox/
https://www.mapbox.com/studio/
https://github.com/jderrough/UnitySlippyMap/pulls
http://forum.unity3d.com/threads/how-do-i-get-my-enemies-to-target-a-random-or-nearby-player-in-an-array.425595/
https://github.com/vvoovv/blender-geo/wiki/Import-OpenStreetMap-%28.osm%29
http://barankahyaoglu.com/dev/openstreetmap-in-unity3d/
http://barankahyaoglu.com/dev/pokemongo-clone-using-mapzen-api-unity3d/
http://barankahyaoglu.com/dev/category/unity3d/
...

Geen opmerkingen:

Een reactie posten