Skip to content

Instantly share code, notes, and snippets.

View radiatoryang's full-sized avatar

Robert Yang radiatoryang

View GitHub Profile
@radiatoryang
radiatoryang / DecentWater.shader
Last active September 26, 2015 22:09
a not-cheap but not-expensive water shader, decent quality DX9 2012-era water, by Robert Yang (@radiatoryang)
// a not-cheap but not-expensive water shader
// decent quality DX9 2012-era water, by Robert Yang (@radiatoryang)
// based on:
// built-in legacy Alpha-Bumped shader
// added cubemap reflection and rimlight stuff
// GlassStainedBumpDistort from Unity glass refraction demo
// http://forum.unity3d.com/threads/grabtexture-uv-correction-in-surface-shader.67742/
// ... this does NOT have fogging or edge blending (too expensive / annoying?)
@radiatoryang
radiatoryang / GPL.md
Created February 20, 2013 20:39 — forked from jnrbsn/GPL.md

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@radiatoryang
radiatoryang / ConsoleEntry.prefab
Created December 15, 2015 03:53 — forked from LordNed/ConsoleEntry.prefab
HTC Vive in-vr Console Viewer. Add the ConsoleLogger script to a gameobject in your scene, and then the UIConsoleViewer to the controller or object you want the console to track. It has a somewhat complicated prefab setup so the prefabs have been attached at the end. I have no idea if you can distribute prefabs this way, so someone gets to find …
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &121470
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22423080}
@radiatoryang
radiatoryang / Cat.cs
Last active March 31, 2016 19:28
Cat and Mouse lab base
using UnityEngine;
using System.Collections;
public class Cat : MonoBehaviour {
// declare a public variable, of type Transform, called "mouse"
public Transform mouse;
bool shouldIPlayASound = false;
@radiatoryang
radiatoryang / LookCast.cs
Last active September 9, 2016 08:56
simple script for my Recursive Reality class to make things with
using UnityEngine;
using System.Collections;
// DIRECTIONS FOR USE:
// put this script on ForwardDirection gameObject in your Oculus camera rig
// it will automatically call a function named "functionToCallOnLook"
// on every script component on that object (the object needs a collider too)
public class LookCast : MonoBehaviour {
@radiatoryang
radiatoryang / PrattCards.cs
Created March 10, 2014 20:41
simple card instantiation for Charles "hard way" Pratt
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PrattCards : MonoBehaviour {
public Renderer cardPrefab;
public List<Texture2D> cardFronts;
public int[] cardFrequency;
@radiatoryang
radiatoryang / GDocService.cs
Created November 27, 2013 22:18
Fetches a public Google Spreadsheet in Unity. (Doesn't work in Webplayer due to the security sandbox.)
// To prepare a Google Spreadsheet for this:
// make sure the spreadsheet has been published to web (FILE >> PUBLISH TO WEB), which is NOT the same as sharing to web
// To use in a different script:
// 1) include "using Google.GData.Client;"
// 2) include "using Google.GData.Spreadsheets;"
// 3) call "GDocService.GetSpreadsheet( string spreadsheetKey );", see DebugTest section for sample usage
using UnityEngine;
using System.Collections;
@radiatoryang
radiatoryang / EnvCubemap.cs
Created May 27, 2013 23:01
Use with the rest of the EnvCubemap*.cs scripts to implement an environment probe system in your Unity project, with models that'll automatically fetch the closest visible probe. For more info, see: http://www.blog.radiator.debacle.us/2013/05/cubemapped-environment-probes-source.html
using UnityEngine;
using System.Collections;
public class EnvCubemap : MonoBehaviour {
public Cubemap cubemap;
public int cubemapRes = 128; // powers of two only
public CameraClearFlags clearFlags = CameraClearFlags.Color;
public Color clearColor = Color.black;
public LayerMask cullingMask;
public float near = 0.1f;
@radiatoryang
radiatoryang / ForceDirectedGraph.cs
Created May 30, 2013 23:20
method for doing force directed graph stuff with NGenerics + Unity... to make it 3D, just change Vector2's to Vector3's
IEnumerator ForceDirectGraph<T>( Graph<T> graph, Dictionary<T, Vector3> graphPositions ) {
// settings
float attractToCenter = 15f;
float repulsion = 10f;
float spacing = 0.1f;
float stiffness = 100f;
float damping = 0.9f;
// initialize velocities and positions
Dictionary<Vertex<T>, Vector2> velocity = new Dictionary<Vertex<T>, Vector2>();
using UnityEngine;
using System.Collections;
// place on a GameObject with an AudioSource component
[RequireComponent(typeof(AudioSource))]
public class PlayRandomSound : MonoBehaviour {
public AudioClip[] sounds; // assign in inspector
// Use this for initialization