Skip to content

Instantly share code, notes, and snippets.

@omikun
omikun / gist:b91ca4e48a14e60f86f1c5d99899aa0c
Last active May 1, 2018 18:33
Course notes from Mr GoodBrush from Schoolism!
Lesson 1 light, shadow, half tones
Form - the deliniation between light and dark; get that right and you can use whatever colors for light/dark
Flatness/half tone - light/dark sides are better flat, all the interesting bits and information is in half tone. Don't put so much value details in light/dark!
Modeling bright means more contrast, when those contrast competes with light/dark, you lose the appearance of brightness in the light
Lighter objects pick up environment color very easily
shape matters the most, once you have shape right, value doesn't matter that much
if you have value right, color doesn't matter that much
@omikun
omikun / csv2anki.txt
Last active March 28, 2018 18:48
Export csv to Anki flash cards
Open csv in Excel, save as Unicode Text
THEN format into CSV (use vi or something) by converting all tabs to comma
DO NOT save as CSV from excel, as this will turn korean characters into ??
Also DO NOT try saving as CSV directly from VS Code, it won't survive conversion to utf8
Make sure csv is indeed using commas as delimiters and not tabs or anything else
Convert file to utf8:
In powershell: Get-Content .\test.txt | Set-Content -Encoding utf8 test-utf8.txt
Add deck or make sure desired deck is selected in Anki, then import file and you're done!!
@omikun
omikun / autoSuspendUnity.py
Created March 2, 2018 07:09
Monitors current window under focus and suspends Unity when it is not in focus in order to save battery life
#!/usr/bin/ python
''' This script automatically finds PIDs for Unity
and suspend those processes whenever Unity is not in focus.
This script is meant to stay running and polls window focus every 1 second
Written March 1st, 2018 by Omikun, compiled from StackOverflow answers:
Identify window under focus:
https://superuser.com/questions/734007/how-do-i-tell-which-app-stole-my-focus-in-os-x
Get PID by process name
@omikun
omikun / game_definition.txt
Created November 10, 2017 01:50
definition of scythe game rules, draft1
//define game
win condition: player with most coins
player has stats {powers, coins, hearts, mechs, buildings, enlistments}
player has x cards, each card with 2 actions {top row action, bottom row action}
player move in hex grid
player chooses one action card and perform up to two actions
nouns: tile, resource, mech, building, coin, power, heart, enlistment
verbs: move, build, deploy, upgrade, enlist,
@omikun
omikun / scythe_board.cs
Last active November 10, 2017 01:50
Scythe hex board init code
using System.IO;
using System;
//data structure for hex grid
class HexLink
{
public Hex link = null;
public bool river = false;
public HexLink(Hex h=null, bool r=false)
{
@omikun
omikun / Timer.cs
Last active July 27, 2017 00:46
helper classes for managing times w/o an event scheduler
public class Timer {
public float StartTime;
public float Duration;
bool Idle;
public Timer(float d)
{
Idle = false;
Duration = d;
StartTime = Time.time;
}
@omikun
omikun / tipsandtricks.cs
Created July 13, 2017 17:27
Tips and tricks when working in Unity
[ContextMenu("function")]
private void myfunction()
{
//function can be called by right clicking on component and select function
}
@omikun
omikun / preventJitter.cs
Created July 12, 2017 23:45
How to stop jittering objects
//http://answers.unity3d.com/questions/353132/smoothdamp-causes-jitters.html
body.interpolation = RigidbodyInterpolation.Interpolate;
don't parent target to camera that follows it, especially if target or camera is physics driven
if target is physics drive, use fixedUpdate on camera
@omikun
omikun / DogCurve.cs
Last active July 18, 2017 02:23
Missile homing algorithm
//now supports missile acceleration!
Vector3 SlowDogCurve()
{
min.Clear();
var line = GetComponent<LineRenderer>();
//find desired velocity vector
var Vt = target.GetComponent<Rigidbody>().velocity;
var Vm0 = rb.velocity;
var Pt0 = target.transform.position;
var Pm0 = transform.position;
@omikun
omikun / CameraMovement.cs
Created July 11, 2017 19:04
Follows target like in flight sim
//taken from https://github.com/razvanilin/Nebulae/blob/master/Assets/Scripts/CameraMovement.cs
using UnityEngine;
using System.Collections;
public class CameraMovement : MonoBehaviour {
public Transform target;
public float distance = 2.0f;
public float height;