I have basic scene where the cube sits on platform
What I want is if the device is rotated 90 degrees to the left, cube should fall down as shown below
I came up with a solution to tackle that by modifying the Physics2D.Gravity
vector so it should be like following
- Device rotation 0, vector(0, -9.81).
- Device rotation -90, vector(-9.81, 0).
- Device rotation 180, vector(0, 9.81). And so on (Rotation would be anything between 0 to 360 degrees).
I don't know how to calculate that vector based on rotation degree. Any suggestion is much appreciated.
Thanks
Input.gyro.attitude.eulerAngles.z
which works just fine, but the calculations is where I am stuck \$\endgroup\$Physics2D.Gravity = 9.82f * Input.acceleration.normalized;
\$\endgroup\$