This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vrpn.cfg.SAMPLE for VRPN version 07.18 | |
################################################################################ | |
################################################################################ | |
# This file provides comments and examples for the vrpn.cfg file that is read | |
# by the vrpn_server application when it starts up. This is a generic server | |
# application that can start up many but maybe not all servers. | |
# | |
# This has sample lines for a vrpn.cfg file. If you get a new device working, | |
# add a line for it here. DO NOT remove lines from this file (unless |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------ | |
# UIVA (Unity Indie VRPN Adapter) Configuration File | |
# UIVA.cfg | |
# | |
# UIVA is a middle-ware between VRPN and Unity which allows fast, | |
# strong, and user friendly device connection in Unity Indie via | |
# VRPN | |
# | |
# This configuration file specifies which devices to enable and | |
# their address. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Sprites/OpaqueSnapNoTint" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
} | |
SubShader | |
{ | |
Tags |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these are just for trying to make the same code shorter | |
// original code | |
document.onkeydown=function(e){e=e||window.event;document.getElementById(e.keyCode==37?"kill-good":e.keyCode==39?"kill-bad":"sg").click();}; | |
// optimized | |
document.onkeydown=function(e){document.getElementById(e.keyCode==37?"kill-good":e.keyCode==39?"kill-bad":"sg").click()} | |
// shorter version. Left = yes, Other keys = no | |
document.onkeyup=function(e){document.getElementById(e.keyCode==37?'kill-good':'kill-bad').click()} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
// attach to UI Text component (with the full text already there) | |
public class UITextTypeWriter.cs : MonoBehaviour | |
{ | |
Text txt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class ExampleClass : MonoBehaviour // Try to name classes so other developers can infer their functionality. Abstract classes are prefixed with 'Base' | |
{ | |
private enum WidgetType // Enums should end in 'Type' and can be inlined with the class if private, but generally should be relocated if public | |
{ | |
None, | |
Circle, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MaterialToggle(_INVERT_OFF)] _Invert ("Invert", Float) = 0 | |
.. | |
#pragma multi_compile _INVERT_ON _INVERT_OFF | |
.. | |
#if _INVERT_ON | |
.. | |
#else | |
.. | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNITY_MATRIX_IT_MV[0].xyz = ??? | |
UNITY_MATRIX_IT_MV[1].xyz = Camera Up | |
UNITY_MATRIX_IT_MV[2].xyz = Camera Forward | |
float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22); | |
cameraFwd = -unity_MatrixInvV._m02_m12_m22; | |
float3 up = normalize(UNITY_MATRIX_V._m10_m11_m12); | |
float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02); | |
float3 cameraUp = unity_CameraInvProjection[1].xyz; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
public class LerpColor : MonoBehaviour { | |
public float lerpDuration = 2; | |
public Slider slider; | |
public Text textTime; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// c# | |
float atan2Approximation(float y, float x) // http://http.developer.nvidia.com/Cg/atan2.html | |
{ | |
float t0, t1, t2, t3, t4; | |
t3 = Mathf.Abs(x); | |
t1 = Mathf.Abs(y); | |
t0 = Mathf.Max(t3, t1); | |
t1 = Mathf.Min(t3, t1); | |
t3 = 1f / t0; | |
t3 = t1 * t3; |