Skip to content

Instantly share code, notes, and snippets.

View kormyen's full-sized avatar

Hamish MacDonald kormyen

View GitHub Profile
@kormyen
kormyen / GyroCamera.cs
Last active September 22, 2023 13:37
Unity3D script for rotating camera with a phone's gyro. Includes smoothing and initial offset. Edited from https://forum.unity3d.com/threads/sharing-gyroscope-camera-script-ios-tested.241825/
using UnityEngine;
using System.Collections;
public class GyroCamera : MonoBehaviour
{
// STATE
private float _initialYAngle = 0f;
private float _appliedGyroYAngle = 0f;
private float _calibrationYAngle = 0f;
private Transform _rawGyroRotation;
@kormyen
kormyen / VrModeSwitch.cs
Last active October 17, 2020 10:04
Unity3D script for switching between Cardboard VR mode and "magic window" (non-vr-36-mode). For reference GyroCamera.cs see https://gist.github.com/kormyen/a1e3c144a30fc26393f14f09989f03e1 . For referenced VREyeRaycaster.cs see Unity VR samples https://www.assetstore.unity3d.com/en/#!/content/51519
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.VR;
using VRStandardAssets.Utils;
public class VrModeSwitch : MonoBehaviour
{
// REFERENCE
[SerializeField] private GyroCamera _gyroControl;
@kormyen
kormyen / keybase.md
Last active May 22, 2019 23:51
Keybase auth

Keybase proof

I hereby claim:

  • I am kormyen on github.
  • I am kormyen (https://keybase.io/kormyen) on keybase.
  • I have a public key ASBtt3T8KCgk12n64g75LRX13yyOwSR7bgsVNWfixzUXBAo

To claim this, I am signing this object:

#define WHITE 0xFFFF /* 255, 255, 255 */
#define LIGHTGREY 0xC618 /* 192, 192, 192 */
#define DARKGREY 0x7BEF /* 128, 128, 128 */
#define BLACK 0x0000 /* 0, 0, 0 */
#define NAVY 0x000F /* 0, 0, 128 */
#define BLUE 0x001F /* 0, 0, 255 */
#define DARKCYAN 0x03EF /* 0, 128, 128 */
#define CYAN 0x07FF /* 0, 255, 255 */
#define GREEN 0x07E0 /* 0, 255, 0 */
#define DARKGREEN 0x03E0 /* 0, 128, 0 */