KITASENJU DESIGN BLOG

memo, html, javascript, unity

Entries from 2022-09-01 to 1 month

複数webcamからひとつを選択

using System.Collections; using System.Collections.Generic; using UnityEngine; public class MyWebcam2 : MonoBehaviour { private WebCamDevice[] devices; private WebCamTexture webCamTexture; [SerializeField] private Material outputMat; priva…

VSCodeで参照元を探る

keybooard shortcutでreferencesって検索 すると shift+option+F12 とでてきた 関数上で、そのショートカットを押したら左側にでてきた!

UnityRecorderをscriptから呼ぶ

how to call UnityRecorder from scripts //using UnityEditor.Recorder; var window = (RecorderWindow)EditorWindow.GetWindow(typeof(RecorderWindow)); if(!window.IsRecording()){ window.StartRecording(); } //stop! if(window.IsRecording()){ windo…

UnityEditor play/pause

UnityEditor.EditorApplication.isPaused = true;//pause or resume UnityEditorEditorApplication.EnterPlaymode();//play UnityEditorEditorApplication.ExitPlaymode();//exit

Screen.width was sometimes wrong.

On UnityEditor, when I put my own button on inspector and press it, the Screen.width/Screen.height is wrong. It does not change on update() function. I think this is a very rare phenomenon. Screen.widthがおかしい時があった。 UnityEditor上…

pugでループ

- for ( i=0; i <= 43 ; i++ ) div( id="t" + i ) h2 for:特定の回数ループ ul - for (var x = 0; x < 3; x++) li item #{x} h2 each:配列をループ ul - var list = ['1','2','3'] each item in list li item #{item} h2 ついでに連想配列each ul - var li…

Loaderで外部ファイルを複数ロードする

import * as THREE from 'three'; import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js' interface ObjData { url : string; mesh : THREE.Mesh; } export class ObjLoaders { public list:ObjData[]; private callback:()=>void; private …

lil-guiでaddColor使う

datguiの代わりlig-guiで色 bgColor:{color:number} = {color:0xff0000}; this.renderer.setClearColor(new THREE.Color(this.bgColor.color)); this.gui.addColor(this.bgColor,"color").onChange((value:number)=>{ this.renderer.setClearColor(new THREE…

typescriptでdictionary

TypeScriptの型: 辞書型を定義する (Dictionary)|まくろぐ

OBJLoaderなどの使い方

//import { ColladaLoader } from 'three/examples/jsm/loaders/ColladaLoader.js' //import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js' const loader = new OBJLoader(); loader.load('./data/q.obj', (obj)=>{ let mesh = obj.childre…

typescriptでinterface

export interface Point3 { x:number, y:number, z:number }

threejs用語(phongMaterial)

three.js docs 色 color = 照明の影響を受ける色 emissive = 他の照明の影響を受けない色 emissiveIntensity = その強度 specular specular = ハイライトの色、鏡面反射 shininess = ハイライトのシャイニー度で大きいほどシャープになる デフォ30 reflect…

RenderTextureをpngに保存(高速版)

save render texture as png pngとして画像を保存 using System.IO; using UnityEngine; using UnityEngine.Assertions; using UnityEngine.Rendering; using UnityEngine.UI; public class RenderTex2PNG : MonoBehaviour { [SerializeField] private Rende…

rayを使わずマウス位置を取得

Vector3 getMousePos(){ var p = Input.mousePosition; _mousePos.x = 2f*(p.x / (float)Screen.width - 0.5f); _mousePos.y = 2f*(p.y / (float)Screen.height -0.5f); float screenH = (float)_camera.orthographicSize;//OrthographicCameraにおける高さ …

chromeでスマホorientationテスト

devtool開く、 cmd+shift+pで検索窓みたいなのを出す、 そこにsensorsと入力、 show sensorsを選ぶ

イラレで曲線を直線群に

illustratorで描いた曲線を直線の集合に変換したいイラスト... - Yahoo!知恵袋

短冊状に切るシェーダー

いろんな角度で行けるように極座標にする 回転後の座標系を使い、ランダム関数に渡して短冊状のずれを生む float gx = glitch.z;//分割数 vec2 displace = vec2(0.0,0.0); float rad = glitch.y;//; //座標を回転 float nx = newUV.x * cos(-rad) - newUV.y …

webaudioをpause

this.context.suspend(); this.context.resume();

"FOOTER"