This is stupid, but i cant for the life of me see where i went wrong.
Any help greatly appreciated
using UnityEngine;
using System.Collections;
public class GravityShift : MonoBehaviour
{
void Update ()
{
if (!RotateTriggers.canRotate && !isOnWall)
{
rigidbody.AddForce(new Vector3(0, -gravity * rigidbody.mass, 0));
}
if (RotateTriggers.canRotate)
{
Quaternion localRot = Quaternion.FromToRotation(-transform.up, Vector3.right) * transform.rotation;
transform.rotation = Quaternion.RotateTowards(transform.rotation, localRot, 10);
rigidbody.AddForce(new Vector3(gravity * rigidbody.mass, 0, 0));
}
if (RotateTriggersWall.canRotateToWall)
{
if (Input.GetButtonDown("Jump"))
isOnWall = true;
}
if (isOnWall)
{
Quaternion localRot = Quaternion.FromToRotation(-transform.up, Vector3.right) * transform.rotation;
transform.rotation = Quaternion.RotateTowards(transform.rotation, localRot, 10);
rigidbody.AddForce(new Vector3(gravity * rigidbody.mass, 0, 0));
}
}
}
}
}