Create a gist now

Instantly share code, notes, and snippets.

A compass ring that points itself to an object in 3D space
using UnityEngine;
using System.Collections;
public class AlignedCompassRings : MonoBehaviour {
public GameObject yRing;
public GameObject north;
public float zOffset = 0.0f;
void Awake() {
void Start() {
void Update() {
var localRotation = yRing.transform.localRotation.eulerAngles;
yRing.transform.localRotation = Quaternion.Euler(localRotation.x, localRotation.y, zOffset);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment