Skip to content

Instantly share code, notes, and snippets.

View runewake2's full-sized avatar

Sam Wronski runewake2

View GitHub Profile
@runewake2
runewake2 / ProjectileReflectionEmitterUnityNative.cs
Created January 16, 2018 05:37
Demonstrates a projectile reflecting in 3D Space a variable number of times in Unity 3D
using UnityEditor;
using UnityEngine;
/*
* Projectile reflection demonstration in Unity 3D
*
* Demonstrates a projectile reflecting in 3D space a variable number of times.
* Reflections are calculated using Raycast's and Vector3.Reflect
*
* Developed on World of Zero: https://youtu.be/GttdLYKEJAM
@runewake2
runewake2 / DynamicUniformPoligon.cs
Created December 22, 2017 05:08
Unity3D Script to generate a uniform N sided polygon.
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent(typeof(MeshFilter))]
public class DynamicUniformPoligon : MonoBehaviour
{
private MeshFilter filter;
public int initialSides = 3;
@runewake2
runewake2 / FlowLines.cs
Last active November 25, 2022 21:57
Custom Unity Line Renderer for drawing gizmo style lines in Unity including play mode. Implemented during this video: https://youtu.be/s926MfazI50
using UnityEngine;
// Recommended to attach this script to the Main Camera instance.
// Will not render in play mode if not attached to Camera.
[ExecuteInEditMode]
public class FlowLines : MonoBehaviour
{
public Color baseColor;
public Material material;
@runewake2
runewake2 / FlightController.cs
Created November 16, 2017 05:46
The basic 6 Degrees of Freedom Spaceship controller build as a part of 6 Degrees Of Freedom Spaceship - The Wrong Way video: https://youtu.be/C7PtRXH3e-Y
using UnityEngine;
// Basic flight controller designed to demonstrate Gimble Locking in 3D space.
// This works by calculating rotation based on Euler angles instead of other methods.
public class FlightController : MonoBehaviour
{
public float speed;
public float rotationSpeed;
void Update ()
@runewake2
runewake2 / PrefixTree.cs
Created September 26, 2017 02:52
A simple implementation of a Prefix Tree with the ability to Add words and Search for them.
using System;
using System.Collections.Generic;
namespace Trees
{
// Prefix Tree built for World of Zero: youtube.com/worldofzerodevelopment
public class PrefixTree
{
private PrefixTreeNode root;
@runewake2
runewake2 / EmissiveRimCutout.shader
Created September 15, 2017 05:24
A shader for Unity 3D that uses vertex colors to determine the clipping of pixels. An additional rim glow is added around the cutoff area.
Shader "Custom/Rim Cutout" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_RimGlowRadius("Rim Glow Radius", Range(0,1)) = 0.1
}
SubShader {
Tags { "RenderType"="Opaque" }
@runewake2
runewake2 / HologramShader.shader
Created August 17, 2017 05:28
A sample hologram shader built as a part of World of Zero during this video: https://youtu.be/vlYGmVC_Qzg
// Hologram Shader built for World of Zero
Shader "World of Zero/Hologram"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1, 0, 0, 1)
_Bias("Bias", Float) = 0
_ScanningFrequency ("Scanning Frequency", Float) = 100
@runewake2
runewake2 / DungeonTriplanarShader.shader
Created July 22, 2017 04:23
World of Zero Tiling Triplanar Shader
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
Shader "Custom/TriplanarWorldShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_WallTexture("Wall Normal", 2D) = "bump" {}
_CeilingTexture("Ceiling Normal", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
@runewake2
runewake2 / FancyBoxShader2.shader
Created July 14, 2017 05:28
An extension of the original FancyBoxShader. This adds the ability to "Spherify" your mesh. Developed in https://youtu.be/sb51BFBdz_M
Shader "Custom/FancyBoxShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_OriginOffset ("Offset", Float) = 0.0
_Offset("Offset", Vector) = (0,0,0,0)
_Skew ("Skew", Vector) = (0,0,0,0)
_Rotation ("Rotation", Vector) = (0,0,0,0)
@runewake2
runewake2 / FancyBoxShader.shader
Created July 13, 2017 05:28
Shader code from Transformation Matrices Shader video on World of Zero
// Shader developed for the Transformation Matrices Shader video on World of Zero.
// https://www.youtube.com/watch?v=VzhxginBhdc
// Developed for Boxes/Cubes but should work anywhere
Shader "Custom/FancyBoxShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_OriginOffset ("Offset", Float) = 0.0