Skip to content

Instantly share code, notes, and snippets.

#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;
@renaudbedard
renaudbedard / gist:7a90ec4a5a7359712202
Created September 11, 2014 18:39
Billboarding for Unity surface shaders
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
// get the camera basis vectors
float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22);
float3 up = float3(0, 1, 0); //normalize(UNITY_MATRIX_V._m10_m11_m12);
float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02);
// rotate to face camera
using UnityEngine;
using UnityEngine.UI;
public class NonTouchable : MonoBehaviour, ICanvasRaycastFilter
{
public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return false;
}
}
@thorikawa
thorikawa / japanese.txt
Last active March 8, 2022 00:07
日本語の文字コード範囲指定(ascii・ひらがな・カタカナ・頻出漢字)
32-128,12288-12543,12448-12543,65280-65519,19968,19971,19977,19978,19979,20013,20061,20108,20116,20154,20241,20808,20837,20843,20845,20870,20986,21147,21313,21315,21475,21491,21517,22235,22303,22805,22823,22825,22899,23376,23383,23398,23567,23665,24029,24038,24180,25163,25991,26085,26089,26376,26408,26412,26449,26519,26657,26862,27491,27671,27700,28779,29356,29577,29579,29983,30000,30007,30010,30333,30334,30446,30707,31354,31435,31481,31992,32819,33457,33609,34411,35211,35997,36196,36275,36554,37329,38632,38738,38899,19975,20024,20132,20140,20170,20250,20307,20309,20316,20803,20804,20809,20844,20869,20908,20992,20998,20999,21069,21271,21320,21322,21335,21407,21451,21476,21488,21512,21516,22238,22259,22269,22290,22320,22580,22768,22770,22799,22806,22810,22812,22826,22969,22985,23460,23478,23546,23569,23721,24037,24066,24112,24195,24215,24339,24341,24351,24369,24375,24403,24418,24460,24515,24605,25144,25165,25945,25968,26032,26041,26126,26143,26149,26172,26178,26228,26332,26360,26397,26469,26481,27005,27468,274
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class CustomTrailRenderer : MonoBehaviour {
IEnumerator Start() {
var target = (Transform)null;
while (target == null) {
target = transform.parent;
@nemotoo
nemotoo / .gitattributes
Last active October 14, 2024 00:03
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@mattatz
mattatz / WindowControl.cs
Last active July 22, 2024 22:58
Unityの画面の位置や解像度の指定、タイトルバーの消去などを行うユーティリティ
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;
namespace Utils {
// ここからコードを拝借させてもらいました!
// http://answers.unity3d.com/questions/13523/is-there-a-way-to-set-the-position-of-a-standalone.html
@kaiware007
kaiware007 / WindowControl.cs
Last active December 17, 2022 23:54
実行中のUnityアプリのウィンドウの位置をマウスやキーボードで動かしたり、タイトルバーを非表示にしたりするスクリプト(Windows only)
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class WindowControl : MonoBehaviour {
// 参照元
// http://answers.unity3d.com/questions/13523/is-there-a-way-to-set-the-position-of-a-standalone.html
// http://stackoverflow.com/questions/2825528/removing-the-title-bar-of-external-application-using-c-sharp
// https://gist.github.com/mattatz/ca84b487c5697e7d43f8216c57a2b975
using System;
using UnityEngine;
using UnityEngine.Playables;
public class PlayAnimation : MonoBehaviour
{
public Animator animator;
public AnimationClip clip;
[NonSerialized] private PlayableGraph m_Graph;