KITASENJU DESIGN BLOG

memo, html, javascript, unity

Entries from 2021-01-01 to 1 year

Clothシミュレーションを使う

Default cloth simulation in Unity 【Unity】Cloth コンポーネントを使って布の動きを表現する方法 | STYLY Cloth - Unity マニュアル マニアックな問題

Draw Cube with Line

関連:https://kitasenjudesign.hatenablog.com/entry/2021/11/13/133126 using System.Collections; using System.Collections.Generic; using UnityEngine; public class LineMesh : MonoBehaviour { [SerializeField] private MeshFilter _meshFilter; [S…

Unityのヒエラルキーで入れ子を全部オープンするショートカット

option(alt) + クリック shortcut ショートカット

Unityで影が出ない時

以下の四つ projectSettingのqualityがlowとかになっていないかチェック Sceneのウィンドウの上部で、ライトがオンになっているのをチェック DirectionalLightとかで、shadow castがオンになっているのをチェック 対象物のshadow caster recieverをチェック

Unity Default Panorama Texutre 2048

photoshopでマスク

フォトショがよくわからない。パスでマスクを作るときはこんな感じで良いのだろうか。 全然直感的でない。 マスクされたいレイヤーを選ぶ 右クリックからクリッピングマスクを作成 その下のレイヤーにマスクしたいパス?をかいておく

Simple FPS Counter

count frame every second. using System.Collections; using System.Collections.Generic; using UnityEngine; public class FPSCounter : MonoBehaviour { private int _counter=0; private float _time = 0; public int fps =0; public static int Fps=0;…

Unityで作ったアプリがAndroidで上部などに黒い帯が入る時

render outside safe areaにチェックを入れる

mac(のxcode)を軽くする

mac

150Gくらい軽くなった qiita.com

ARCoreで画像トラッキングを使うときのサイズ注意点

$ arcoreimg eval-img --input_image_path=hoge.png というのでチェックして0以上の数値が出ないと、apkコンパイル時にエラー 画像サイズや余白の調整でなんとかなることがあった

さくひんづくり

現状の問題点 具体例 仮説 仮説をもとにした作品

unityでfeedbackEffectを作る

feedbackするためには、現在のフレームframe(t)に過去フレームframe(t-1)を描画する必要がある。 frame(t) = effect( frame(t), frame(t-1) ); ① メインcameraのonRenderImageでrenderTextureAに描画(ノイズ等でずらしたり、位置を動かしたり)。これは描画…

1秒ごとにInstantiate

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Rakka : MonoBehaviour { [SerializeField] private Ball[] _prefabs; private int _count=0; void Start() { _loop(); } private void _loop(){ int index =…

Inspector上のボタンを横に並べる

align buttons horizonally on Inspector 8個x3行、かいた for(int j=0;j<3;j++){ EditorGUILayout.BeginHorizontal(); for(int i=j*8;i<8*(j+1);i++){ if (GUILayout.Button(""+i,GUILayout.Width(30))){ exampleScript.SendMessage ("SetEffect", i, SendM…

unityで曜日・日付を使う

string[] youbiAry = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; string[] monthAry = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; var time = DateTime.Now; var hh = time.Hour.ToString("00"); va…

Reset Wi-Fi setting on FRAMED MONO X7

FRAMED MONO X7のwifi設定をリセットする方法 前提 まずスマホアプリがうまくいかなかった うまくいった方法 PCで https://frm.fm/settings/devices にアクセス NEW SETUPからwifi設定等を入力、Download Settingsからxmlをダウンロード。 そのファイルをUSB…

shader dot pattern

https://glslsandbox.com/e#77263.0 #extension GL_OES_standard_derivatives : enable precision highp float; uniform float time; uniform vec2 mouse; uniform vec2 resolution; void main( void ) { vec2 position = ( gl_FragCoord.xy / resolution.xy…

ふたつのsmoothstep

//return x * x * (3.0 - 2.0 * x); return 6.0*x*x*x*x*x - 15.0*x*x*x*x + 10.0*x*x*x;

アイコンを探す

icon ikonate.com https://remixicon.com/ https://ionic.io/ionicons

draw lines randomly on unity

ランダムに線を描く using System.Collections; using System.Collections.Generic; using UnityEngine; public class Lines : MonoBehaviour { [SerializeField] private MeshFilter _meshFilter; private Vector3[] _positions; private Mesh _mesh; // St…

微分と積分を位置・速度・加速度で理解する

微分=傾き 位置が時間とともに変化していく 位置の変化量=速度 速度の変化量=加速度(→速度一定なら加速度0) 積分=面積 速度の積分=距離(=位置) 加速度の積分=速度(加速度が一定の値なら、その面積(速度)は一定で増えていく)

circle wave 円弧波

glslのコード float circleWave(float t) { float d=1.0; float st = sin(d * 3.1415 / 2.0); float p = (mod(t * 4.0, 2.0) - 1.0) * st; float a = sqrt(1.0 - pow(p, 2.0)); float amax = sqrt(1.0 - pow(st, 2.0)); float b = sign(mod(t, 1.0) - 0.5); …

ZXingでQRコード作る

using System.Collections; using System.Collections.Generic; using UnityEngine; using ZXing; using ZXing.QrCode; using System.IO; public class BarcodeMaker : MonoBehaviour { private Texture2D _tex; void Start() { var text = "http://hogehoge…

particle system rescale

子供のパーティクルサイズを親のスケールにあわせてリスケール public class ChildParticleScaler : MonoBehaviour { float scale; List<ParticleSystem> particles = new List<ParticleSystem>(); void Start() { scale = transform.localScale.x; particles.AddRange(GameObject.FindObject</particlesystem></particlesystem>…

Mapping function - マッピング関数

js function map (value, fromMin, fromMax, toMin, toMax){ return (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin; } glsl float map (float value, float fromMin, float fromMax, float toMin, float toMax){ if(value<fromMin)value=fromMin; if(value>fromMax)valu</frommin)value=frommin;>…

シェーダーで陰つける

陰影の、陰(shader)をつける Shader "RDSystem/Surface2" { Properties { _MainTex("RD Texture", 2D) = "white" {} [Space] _Color0("Color 0", Color) = (1,1,1,1) _Color1("Color 1", Color) = (1,1,1,1) [Space] _Smoothness0("Smoothness 0", Range(0, …

ParticleSystemのrenderer moduleへのアクセス

gameObject.GetComponent<ParticleSystemRenderer>();</particlesystemrenderer>

trail rendererのresetがおかしい

おかしいので trail rendererだけgameObjectを単独にし、使う時だけInstansiateする。

vfx graph start/stop

using UnityEngine.VFX; VisualEffect _effect; _effect.Play(); _effect.Stop();

generating 3d texture on script

var info = new RenderTextureDescriptor(); info.dimension=UnityEngine.Rendering.TextureDimension.Tex3D; info.colorFormat = RenderTextureFormat.ARGB32; info.width = 512; info.height=256; info.volumeDepth=90; info.depthBufferBits = 0; info.ms…

"FOOTER"