Hi all,
my objective is to control world gravity using the y axis of an object. The reason being is to control gravity using the tilt sensors of a mobile device. Im using GyroDroid to rotate the object containing this script.
I’ve looked through Unity answers, many in Java, and cant figure out what the heck I’m doing wrong. I’m an Artist so please be kind! I’m coding in C#
Here’s what I have so far;
public class gravityForce : MonoBehaviour
{
private Quaternion gravityDirection;
void FixedUpdate ()
{
gravityDirection = Quaternion.FromToRotation(transform.up, -Physics.gravity);
Physics.gravity = gravityDirection;
}
}
Any advice is appreciated
Thanks in advance!