Skip to content

Instantly share code, notes, and snippets.

View RyanWilson7's full-sized avatar
Drinking coffee somewhere

Ryan Wilson RyanWilson7

Drinking coffee somewhere
View GitHub Profile
@RyanWilson7
RyanWilson7 / RotateAxisOnCompass.cs
Last active November 26, 2020 06:48
Unity script for rotating a GameObjects transform to compass direction on a given axis
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateAxisOnCompass : MonoBehavior
{
enum Axis { x, y, z }
[SerializeField] private Axis rotateAxis;
[SerializeField] private float compassSmooth;
private float lastMagneticHeading;
private void Start()