Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Perry omgwtfgames

View GitHub Profile
@omgwtfgames
omgwtfgames / vector.py
Last active Aug 27, 2017 — forked from jordvisser/vector.py
A vector class in pure python.
View vector.py
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@omgwtfgames
omgwtfgames / HelicalLayout.cs
Created Aug 9, 2017
Helical object layout in Unity
View HelicalLayout.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class HelicalLayout : MonoBehaviour
{
int _numberOfNodes;
public float Radius = 1f;
public float Pitch = 1f;
public float Turn = 30f;
View LootTable.cs
// A loop drop table for Unity, somewhat inspired by http://www.lostgarden.com/2014/12/loot-drop-tables.html
// TODO: Use properties { get; set } to automatically call UpdateWeightRanges() when
// any Weight is changed, or any item is added or removed from the list
// We could then also add an autoupdating (readonly) Sum field, replacing calls to GetSumOfWeights()
// TODO: Rather than making Prefab a GameObject, call it Obj and make this a LootTable<T> generic so we
// can use any type as the associated object.
//
@omgwtfgames
omgwtfgames / TagsLayersEnumBuilder.cs
Created Apr 25, 2016 — forked from Namek/TagsLayersEnumBuilder.cs
Tags and Layers Enums Builder for Unity3D
View TagsLayersEnumBuilder.cs
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
using System;
using System.IO;
using System.Text;
public class TagsLayersEnumBuilder : EditorWindow {
[MenuItem("Edit/Rebuild Tags And Layers Enums")]
@omgwtfgames
omgwtfgames / LetterSpacing.cs
Last active Apr 24, 2016 — forked from tommycutter/LetterSpacing.cs
Letter Spacing Component for Unity 5.3, 5.4
View LetterSpacing.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/*
http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
Unity 5.1 and 5.2.2+ compatible
Produces an simple tracking/letter-spacing effect on UI Text components.
@omgwtfgames
omgwtfgames / VRInputModule.cs
Created Apr 22, 2016 — forked from flarb/VRInputModule.cs
Lets you use a VR world space cursor with World Space Canvases in Unity3D 4.6. Add this to the EventSystem object. Put some box colliders on your buttons in the World Space Canvas. Then, do a trace to see if you're looking at a menu object--if the trace hits one of those buttons, pass it to SetTargetObject. See ralphbarbagallo.com for a longer e…
View VRInputModule.cs
using UnityEngine;
using UnityEngine.EventSystems;
//by Ralph Barbagallo
//www.flarb.com
//www.ralphbarbagallo.com
//@flarb
public class VRInputModule : BaseInputModule {
@omgwtfgames
omgwtfgames / StareButton.cs
Created Apr 22, 2016 — forked from flarb/StareButton.cs
This is a 'stare button' for Google Cardboard apps where you just want to stare at a button over time to select it.
View StareButton.cs
using System;
using System.Reflection;
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
public class StareButton : MonoBehaviour, IEventSystemHandler, IPointerExitHandler, IPointerEnterHandler, ISelectHandler {
@omgwtfgames
omgwtfgames / cardboardcam_extract.py
Last active Feb 8, 2021
Extracts the audio and second image from a Cardboard Camera panoramic image
View cardboardcam_extract.py
#!/usr/bin/env python
#
# Google Cardboard Camera extractor
# Extracts audio and second image from the XMP header in Cardboard Camera images
# Requires python-xmp-toolkit ( pip install python-xmp-toolkit )
#
# Usage:
# $ carboardcam_extract.py myimage_vr.jpg
#
# Creates two new files - myimage_vr_audio.mp4 and myimage_vr_righteye.jpg
@omgwtfgames
omgwtfgames / UnlitColoredDoubleSided.shader
Created Nov 13, 2015
UnlitColoredDoubleSided.shader
View UnlitColoredDoubleSided.shader
Shader "Unlit Colored Double Sided" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
Category {
Lighting Off
ZWrite On
Cull Off
SubShader {
@omgwtfgames
omgwtfgames / A set of Unity3D extension methods
Last active Apr 19, 2022
Some useful extension method for Unity3D
View A set of Unity3D extension methods
A collection of useful C# extension methods for the Unity engine.