Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

v0.13: VRで快適に移動できる#84

Merged
HMasataka merged 24 commits intomainfrom
feature/v0.13-vr-locomotion
Mar 8, 2026
Merged

v0.13: VRで快適に移動できる#84
HMasataka merged 24 commits intomainfrom
feature/v0.13-vr-locomotion

Conversation

@HMasataka
Copy link
Copy Markdown
Owner

Summary

  • VR向け3方式のロコモーションを実装(テレポート、スムース移動、アームスイング)
  • StereoCamera に HmdRotation を追加し、VR移動システムがHMD前方を参照可能に
  • 酔い対策としてビネットエフェクト状態管理とテレポートフェード遷移を実装

テレポート

  • 放物線アーク計算、Y=0着地判定、フェード遷移(0.15s)、スティック方向選択

スムース移動

  • 左スティック駆動(2.0m/s)、HMD/コントローラー方向切替、ビネットエフェクト

アームスイング

  • 両手コントローラー振り動作、最大5.0m/s、HMD前方移動

Test plan

  • 全790テスト合格(新規45テスト含む)
  • VrSmoothMoveSystemTests: 11テスト(モードガード、方向、速度比例、ビネット)
  • VrArmSwingSystemTests: 8テスト(モードガード、速度クランプ、HMD方向)
  • VrTeleportSystemTests: 14テスト(ステートマシン遷移、アーク計算、方向選択)
  • VrLocomotionComponentTests: 12テスト(IComponent実装、マーシャル可能性)
  • 既存745テストのリグレッションなし

🤖 Generated with Claude Code

HMasataka and others added 24 commits March 7, 2026 21:54
テレポート・スムース移動・アームスイングの3方式を
管理するためのECSコンポーネント群を定義。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VR移動システムがHMDの前方ベクトルを参照するために
Quaternion型のHmdRotationを追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
左スティック駆動のスムース移動(2.0m/s、ビネット対応)と
コントローラー振り動作のアームスイング(最大5.0m/s)を追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
放物線アーク計算、Y=0着地判定、フェード遷移(0.15s)、
スティック方向選択によるテレポート移動を追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MSAA Resolve をトランスペアレントパスの前に移動し、
Resolve テクスチャをコンポジットシェーダーでサンプリングして
スカイグラデーションとアルファ合成するよう修正。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
グリップ保持中に velocity をゼロ化し、リリース時に spring target を
クリアすることで、掴んだオブジェクトが暴れる問題を解消。
トリガー(距離グラブ)でもホールドが維持されるよう判定を拡張。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Push constants を 96→128 バイトに拡張し、ディレクショナルライトの
方向・色・強度を渡して PBR 計算を行うことで、VR でオブジェクトが
ほぼ黒に見えていた問題を解消。ForwardPlusRenderSystem にも同様の
変更を適用。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- VrSmoothMoveSystem をスケジューラに登録
- シングルトンに StereoCamera, VrLocomotionMode, VrLocomotionConfig を追加
- プレイヤーに VignetteState を追加
- StereoForwardPlusRenderSystem にデスクトップミラー機能を追加し、
  左目コンポジット結果をデスクトップウィンドウに描画
- Push constant range を 128 バイトに拡張

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ハードコードされた V=(0,0,1) を実際のカメラ位置から計算するように変更。
オブジェクト空間の位置/法線をモデル行列でワールド空間に変換。
プッシュ定数を 128→208 バイトに拡張(MVP+Model+EyePos+Material+Light)。
StereoCamera の HmdRotation を Identity で初期化。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
StereoCamera.HmdRotation が未設定(ゼロ四元数)のため NaN が発生し
移動が機能しなかった。XrInputUpdateSystem に LocateViews を追加し
毎フレーム HMD の位置と回転を StereoCamera に反映。
ComputeForwardXZ にゼロ四元数ガードを追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
距離ヒューリスティックによる手の判定を廃止し、グラブ時にどちらの手で
掴んだかを GrabbedByHand フィールドに記録。VrDistanceGrabSystem の
グラブ完了時に SpringJoint・GrabberEntity・Velocity を正しく設定。
テストを GrabbedByHand 対応に更新。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- projDist <= GrabRadius を projDist <= 0f に変更し、プル中にオブジェクトが
  GrabRadius 内に入ってもターゲットを見失わないようにした
- プル中に速度をゼロクリアし、物理システムがオブジェクトを逸らす問題を防止

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VR モードではスティック入力を VrControllerState 経由で VrSmoothMoveSystem が
処理するため、InputState に入れると MovementSystem がデスクトップカメラ
(デバッグ十字キューブ)を誤って動かしていた

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- StereoCamera に PlayerPosition フィールドを追加
- VrSmoothMoveSystem で移動後のプレイヤー位置を StereoCamera に書き込み
- StereoForwardPlusRenderSystem で PlayerPosition を読み取り VP 行列と
  眼球位置にオフセットを適用し、スティック移動が VR 視界に反映されるようにした
- オペークパスのクリアアルファを 0 から 1 に変更し、XR コンポジターが
  背景を透過表示する問題を修正

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ステレオ Forward+ パイプラインのライトカリングおよびオペーク用
ディスクリプタセットが 1 バインディング(DirectionalLight バッファのみ)
しか持っておらず、シェーダーが期待する 4〜5 バインディングと不一致だった。
シェーダーが DirectionalLight の float を uint タイルインデックスとして
読み込み NaN が発生し、全ライティング結果が黒になっていた。

- タイルバッファ(左右各 1)、ポイントライト/スポットライト GPU バッファ、
  ライトカウントバッファを新規作成
- ライトカリング用ディスクリプタセットを 5 バインディングに修正
  (深度テクスチャ、ポイントライト、スポットライト、タイル出力、ライトカウント)
- オペーク用ディスクリプタセットを 4 バインディングに修正
  (タイルデータ、ポイントライト、スポットライト、ライトカウント)
- オペークパイプラインのレイアウト参照を修正

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SnapTurnState コンポーネント(エッジ検出用)、VrLocomotionConfig に
SnapTurnAngle フィールド、StereoCamera に PlayerRotation クォータニオンを追加。
構造体サイズテストを 168 → 184 に更新。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VrSnapTurnSystem: 右スティック X 軸のデッドゾーン 0.5 でエッジ検出し、
1回のデフレクションで SnapTurnAngle(デフォルト30度)だけ回転。
コンフォートビネット対応。テスト8件追加。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
StereoForwardPlusRenderSystem: PlayerRotation を VP 計算と視点位置に適用。
VrSmoothMoveSystem/VrArmSwingSystem: 移動方向に PlayerRotation を合成。
Program.cs: SnapTurnState 登録、PlayerRotation/SnapTurnAngle 初期化、
VrSnapTurnSystem を VrSmoothMoveSystem の前に配置。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
右スティック右倒しで負の Y 回転(右回転)、左倒しで正の Y 回転(左回転)に修正。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VrGrabSystem / VrDistanceGrabSystem でハンド位置をステージ空間から
ワールド空間へ変換するように修正。移動後のグラブ位置ズレ、
グラブ中の移動・回転追従、投擲方向の回転反映を解決。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
グラブ時のオフセットを PlayerRotation の逆回転でステージ空間に変換して保存し、
毎フレーム現在の PlayerRotation でワールド空間に戻すことで、
スナップターン中もグラブ対象がプレイヤーの回転に追従するように修正。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GrabRotationOffset をステージ空間で保存し、毎フレーム PlayerRotation を
合成してオブジェクトの向きを更新。スナップターン後も掴んだ物体の
見え方が変わらないように修正。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HMasataka HMasataka merged commit 9f25328 into main Mar 8, 2026
3 checks passed
@HMasataka HMasataka deleted the feature/v0.13-vr-locomotion branch March 8, 2026 12:35
@HMasataka HMasataka restored the feature/v0.13-vr-locomotion branch March 8, 2026 12:35
@HMasataka HMasataka deleted the feature/v0.13-vr-locomotion branch March 8, 2026 12:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant