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
velocity = Vector3.ClampMagnitude(velocity, speedScale * controller.globalSpeed); | |
Quaternion rotation = Quaternion.FromToRotation(transform.forward, velocity); | |
transform.rotation = Quaternion.RotateTowards(Quaternion.identity, rotation, controller.globalYawSpeed * yawScale * Time.deltaTime) * transform.rotation; | |
transform.position += transform.forward * velocity.magnitude * Time.deltaTime; |
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
void ShowMaterialEditor(Material[] ms){ | |
for(int i = 0; i < ms.Length; i++){ | |
Material m = ms[i]; | |
if(m == null) | |
return; | |
Shader s = m.shader; | |
EditorGUILayout.LabelField(m.name); | |
EditorGUI.indentLevel++; | |
for(int j = 0; j < ShaderUtil.GetPropertyCount(s); j++){ |
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/surfaceBillbord" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 200 | |
CGPROGRAM | |
#pragma surface surf Lambert vertex:vert |
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 "ImageEffect/Base" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
} | |
SubShader { | |
pass{ | |
ZTest Always Cull Off ZWrite Off | |
Fog { Mode off } | |
ColorMask RGB | |
CGPROGRAM |
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/ImageEffectBase" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" | |
sampler2D _MainTex; | |
half4 _MainTex_TexelSize; | |
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
#ifndef COONSCURVE_INCLUDED | |
#define COONSCURVE_INCLUDED | |
float3 coons(float t, float3 p0, float3 p1, float3 v0, float3 v1) | |
{ | |
float3 a = 2*p0 - 2*p1 + v0 + v1; | |
float3 b = -3*p0 + 3*p1 - 2*v0 - v1; | |
float t2 = t*t; | |
float t3 = t2*t; |
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
float PI = 3.14159265359; | |
float x = (atan2(v.vertex.z,v.vertex.x) - PI/2.0); | |
float y = 2.0*PI; | |
float angle = (x - y * floor(x/y))/(2.0*PI); | |
//いちばん、Unityで、ただしそうな、かきかた | |
float2 p = IN.uv - float2(0.5,0.5); | |
angle = fmod(atan2(p.y,p.x)-PI/2+2*PI, 2*PI)/(2*PI); |
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 "AngryBots/Particle/AlphaBlend" { | |
Properties { | |
_MainTex ("Base", 2D) = "white" {} | |
_TintColor ("TintColor", Color) = (1.0, 1.0, 1.0, 1.0) | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" |
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
Mesh mesh = GetComponent<MeshFilter>().mesh; | |
Vector3 targetPoint; | |
Vector3[] vertices = mesh.vertices; | |
float power; //吸い込まれ力 | |
for(int i = 0; i < vertices.Length; i++){ | |
//ここら変の計算を変えて、吸い込まれ方を調整 | |
float d = (vertices[i] - targetPoint).sqrMagnitude; | |
vertices[i] += (vertices[i] - targetPoint)*Time.deltaTime*d*power; | |
} |
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 CreateMesh { | |
//16250枚Quadが入ったMeshを作る。 | |
[MenuItem("Custom/Create/16250meshes")] | |
public static void CreateParticleMesh(){ | |
Mesh mesh = new Mesh(); | |
int vertexCount = 65000; |
OlderNewer