This file contains 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
v2f vert(Input v) { | |
float4 posWorld = mul(_Object2World, v.vertex); | |
posWorld.xyz += _POS; | |
v2f o; | |
o.vertex = mul(UNITY_MATRIX_P, mul(UNITY_MATRIX_V, posWorld)); | |
o.uv = v.uv; | |
return o; | |
} |
This file contains 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 System; | |
void Test(string t){ | |
Debug.Log(t); | |
} | |
void Main(){ | |
Action<string> a = Test; | |
a("test"); | |
} |
This file contains 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
// Quaternion multiplication. | |
// http://mathworld.wolfram.com/Quaternion.html | |
float4 qmul(float4 q1, float4 q2) | |
{ | |
return float4( | |
q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), | |
q1.w * q2.w - dot(q1.xyz, q2.xyz) | |
); | |
} |
This file contains 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 "Custom/QuaternionTest" { | |
Properties { | |
_AX("axis", Vector) = (0,0,0,0) | |
_TH("theta", Float) = 0 | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" | |
#define PI 3.1416 | |
This file contains 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 UnityEditor; | |
using System.Collections; | |
public class CreateTex3D : EditorWindow | |
{ | |
[MenuItem("sugi.cho/Window/CreatePerlin3DTexture")] | |
public static void Init () | |
{ | |
EditorWindow window = EditorWindow.GetWindow (typeof(CreateTex3D)); |
This file contains 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 UnityEditor; | |
using System.Collections; | |
public class BakeTransformToMesh | |
{ | |
[MenuItem("sugi.cho/Mesh/Bake Transform")] | |
public static void BakeTransform () | |
{ |
This file contains 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
public event System.Action<int> OnJoin; | |
void Init(){ | |
this.OnJoin += JoinAction; | |
} | |
void JoinAction(int id){ | |
list.Add(id); | |
} |
This file contains 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
var manager = GetComponent<NetworkManager>(); | |
manager.StartServer(); //server | |
manager.StartClient(); //client | |
manager.StartHost(); //serverかつclient | |
manager.StopServer(); |
This file contains 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 UnityEngine.Networking; | |
public class MyNetManager:NetworkManager{ | |
public override void OnStartClient(NetworkClient client){ | |
base.OnStartClient(client); | |
//処理 | |
} | |
public override void OnClientConnect(NetworkConnection conn){ | |
//..... |