Skip to content

Instantly share code, notes, and snippets.

View rngtm's full-sized avatar
💭
I may be slow to respond.

rngtm rngtm

💭
I may be slow to respond.
View GitHub Profile
@rngtm
rngtm / gist:4737466
Last active December 12, 2015 07:38
テスト
/*
* (x1,y1)と(x2,y2)を通る直線に速度(*vx,*vy)で移動する物体がぶつかった時の反射を計算するです。
* 直線に沿って摩擦frictionと反発係数reboundを設定できるです。
*/
void Refrection(double *vx,double *vy,double x1,double y1,double x2,double y2,double friction,double rebound){
double tanx;
double a11,a12,a21,a22;
double bunbo;
double x,y;
#include<stdio.h>
int main(){
char _[]="hello!world";
char a[]="hello!world";
char b[]="hello!world";
char c[]="hello!world";
char d[]="hello!world";
char e[]="hello!world";
char f[]="hello!world";
char g[]="hello!world";
@rngtm
rngtm / TestCoroutineWindow.cs
Last active December 6, 2016 09:21
EditorWindowからコルーチンを実行させるコードサンプル
namespace hoge
{
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
public class TestCoroutineWindow : EditorWindow
{
public TestMonobehaviour targetObject;
@rngtm
rngtm / TestReorderableListWindow.cs
Last active December 6, 2016 09:23
ReorderableListをList<T>から作成して表示するサンプル
namespace hoge
{
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
public class TestReorderableListWindow : EditorWindow
{
[SerializeField] private List<int> list = new List<int>();
@rngtm
rngtm / TestWindowReorderableListFooterChange.cs
Last active June 7, 2019 11:39
ReorderableListのフッターの位置を変更するサンプル
namespace hoge
{
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
public class TestWindowReorderableListFooterChange : EditorWindow
{
[SerializeField] private List<int> intList = new List<int>();
@rngtm
rngtm / graph2.pde
Last active January 19, 2017 18:06
http://qiita.com/r-ngtm/items/e4df707d45b097999776 2番目の図のgifを出力するProcessingコード
///////////////////////////////////////////////////////////
// 動作環境: processing-2.2.1 Windows10
// Gif書き出しには GifAnimation のインストールが必須です
///////////////////////////////////////////////////////////
// import gifAnimation.*;
// GifMaker gifExport;
// 色
final color WHITE = color(255);
@rngtm
rngtm / UnlitPolygon
Created June 27, 2017 14:52
正N角形を描画するシェーダー
Shader "Unlit/Polygon"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_N("N", Int) = 3
}
SubShader
{
Tags { "RenderType"="Opaque" }
@rngtm
rngtm / UnlitPolygonLine.shader
Created June 27, 2017 15:27
正N角形の線が描けるシェーダー
Shader "Unlit/PolygonLine"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_N("N", Int) = 3
_W("Width", Range(0, 1.0)) = 0.1
}
SubShader
{
@rngtm
rngtm / Unlit-PolygonColor.shader
Created July 6, 2017 09:39
色を指定して正N角形を描画するシェーダー
Shader "Unlit/Polygon Color"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_N("N", Int) = 4
_Size ("Size", Range(0, 1)) = 0.25
_W("Width", Range(0, 1.0)) = 0.05
_Rotation ("Rotation", Range(0, 360)) = 0
@rngtm
rngtm / EditorSceneViewText.cs
Last active July 6, 2018 09:20
Sceneビューにテキストを表示するUnityエディタ拡張。(https://qiita.com/r-ngtm/items/43dce7b9bde2c090c761)  シーンを開いたとき、同じディレクトリにあるabout.txtの中身をSceneビューに表示します
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.IO; //System.IO.FileInfo, System.IO.StreamReader, System.IO.StreamWriter
using System; //Exception
using System.Text; //Encoding
[InitializeOnLoad]
public class EditorSceneViewText