unity tutorial
Layoutを変える
quality change
revise with + button in Hierarchy
カメラ固定
親コンポーネント(ロジック)、子供コンポーネント
シーンは複製して変えられる
グローバルボリュームはシーン全体
ライトニングは右上のところに置く
フレームレートを合わせることでゆっくり動く
xyzの動きは、vector3で行う(ただし、インプットはvector2)
パブリックにするとオブジェクトにアタッチしたスクリプト欄から、変数を変更できる
マテリアル
シェーダー
プロパティ
アニメーターとアニメーションは違う
何かうまく表示されないときはレイアウト(右上)の可能性も少しだけある
アニメーション録画は小こんぽーねんとにしか適用できない
アニメーションは、時間を動かしてから動きをつける
◇はその時間のフレーム
嫌なこと⭐️
カメラフレームワークや動き、座標が変になる
アニメーションのhas exit time
https://scrapbox.io/files/67012fb8692752001d2c635f.png
Animation (Clip) and Animator (Controller)
プレイヤースクリプトは親のPlayer, 歩くとかのスクリプトは子(中)のPlayervisual(ビジュアルに関することだから?
Time.deltaTime (to make the movement frame-rate independent)
cinemachineは脳3Dをいろいろな角度から見るために結構使えるかもしれない
virtual cameraのノイズで結構遊べる
あるオブジェクトでメインのスクリプトで、そこにインプットを用意すると、そのインプット用のコード(スクリプト)を添付できる
https://scrapbox.io/files/67022bb4ac2ee4001da0a4be.png
input system
https://scrapbox.io/files/67022fca14a9c7001d5455ae.png
inputを使うと、簡単にインプットを設定できる
インプットとゲームインプットの違いがわからない
https://scrapbox.io/files/67036e946efe70001de8838f.png
カメラ
FOVは距離調整
アニメーションは別でアタッチする
コリージョン判定はコード内で定義できる
オブジェクト紐づける時は、visual(.prefab)を紐づける
https://scrapbox.io/files/67039a3ea453de001c5588d4.png
オブジェクトとプレイヤーにレイヤーをつけることで、そのレイヤーだけに適応させる何かを加えることができる
https://scrapbox.io/files/6704035992469d001caffba8.png
at 2:47
Player.cs (Character Movement and Interaction)
This script handles the movement of the player and interactions with objects in the game world.
Key Elements
Movement
The player can move in four directions (WASD or arrow keys)
Movement is calculated as a normalized vector and uses transform.position to update the player’s position
It uses CapsuleCast to detect collisions to prevent movement if there's an obstacle
The rotation of the player is handled using Vector3.Slerp to smoothly rotate towards the direction they are moving in
Interaction
When the interact key (defined in GameInput) is pressed, the player interacts with objects in the game world.
The interaction is handled by a #raycast that checks if there is any object within a certain distance (interactDistance) and layer mask (countersLayerMask)
If an object with a ClearCounter component is hit, it triggers the Interact() method on that component
IsWalking
This method returns whether the player is moving or not, based on whether the movement vector is non-zero
PlayerAnimator.cs (Animating the Player)
This script manages the player's animation state based on movement
Key Elements
Animator Component
In Awake(), the script grabs the Animator component attached to the player
In Update(), it checks if the player is walking by calling IsWalking() from the Player script
If the player is walking, it sets the animation parameter IsWalking to true, otherwise false
This triggers corresponding animations (walking or idle) in the Animator Controller
ClearCounter.cs (Interaction System)
This script represents an object in the game world (e.g., a counter) that the player can interact with
Key Elements
Interact Method
When the player interacts with an object that has this component, it logs "Interact!" to the console
In a real game, this method could trigger more complex interactions, like picking up an item
GameInput.cs (Input Handling)
This script manages the player's input using Unity's Input System package
Key Elements
Input Handling
The playerInputActions object is used to map player inputs (movement and interaction)
The input is enabled in Awake() and listens for interaction inputs via the Interact.performed event
When the player presses the interact key, the OnInteractAction event is invoked, which triggers the interaction logic in the Player script
Movement Input
The GetMovementVectorNomalized() method reads input from the player (WASD or arrow keys) and returns the normalized movement vector for use in the Player script
How These Scripts Work Together:
Input
The GameInput script listens for player input (movement and interaction)
When the player moves, the movement vector is normalized and passed to the Player script
When the player presses the interact key, an interaction event is triggered.
Player Movement
The Player script handles moving the player in response to input from GameInput
It also handles checking for obstacles and adjusting the movement direction accordingly
Additionally, it checks for nearby interactable objects (using Physics.Raycast) and interacts with them if they have a ClearCounter component
Player Animation
The PlayerAnimator script listens for the player's movement state
If the player is moving, it updates the animator's IsWalking parameter to trigger walking animations
Interaction
When the player presses the interaction button, the Player script casts a ray in the direction of the player's last movement
If it hits an object with a ClearCounter component, it triggers the Interact() method on that object
オブジェクトにパーティクルを紐づけるのをVFX Property BInder
VFXなどで自分がやりたいことを整理しておく
あるオブジェクトのある一部に変数を入れる(変数入れるというより、"時間/速度"と"強さ"を指定できれば良い)ことの方法は分かってない
基本的にオブジェクトにvfxをアタッチすると思うが、、、どこに何をアタッチすれば良いかわからない?(ただ基本的にロジックは同じはずなので、全オブジェクトに同じvfxを入れられるはず。細かい分岐はある?⭐️どこまで再現するかという話もある)
strip(親、子)を使うと、パーティクル同士を繋げることができる?
結局、パーティクルにおいて線というのは存在しないぽい
そもそもの始まりはspawn(色々なタイプがある)で指定する
これに関して、複雑な設定が必要いなイメージはない
基準
時間
ポジション(⭐️)
動くオブジェクトに星がついていくとかできる(本162p)
外部でsphere_positonを設定(これとオブジェクトの紐付け型は忘れた)
なんとかbinder
これをupdateのset positionにも紐づける
イベントバインダー
マウス
コリジョン
アクション
ビジビリティ
あるところからあるところに向かわせるのは、単位ベクトル計算(ベクトルの減算、正規化)
パーティクルには角度(angle)があるらしいが、俺には関係ない気がする
set velocityで色々調整できる(randomとか繋げられる)
https://scrapbox.io/files/670de40ead71a1001c65ddfc.png
実行/生成回数?にはフレームという概念が強く関係している模様
OutputをURP Lit Quadにすると、光の影響を受けられるようになる
テクスチャにカラーがあれば、カラーセットしたくない
⭐️見直すべきところ⭐️
Total Time (VFX)
諸々の角度計算系
計算のロジックわからなくもないが、AとかBがわからん(何をrepresentしている?)
テクスチャに連続したテクスチャを入れて、それをUVなんとかで順番に表示するとかできるらしい(爆発シーンとか)
設計
initial
update
タイミング(トリガー)
大きさ
場所
向き
テクスチャなど
particle to particle
output
ここがわからん(updateで定義しないものをここで定義すると思うのだが)
orient
割れる系(頂点分裂系)はhoudini使わないといけなさそうで大変
オブジェクトにマテリアルを適用する(オブジェクトとマテリアルは別)