I will inspect the project structure and existing files to see what libraries and setup we have.
I will read package.json to see the installed dependencies.
I will install three, @types/three, lucide-react, and canvas-confetti for 3D voxel rendering, kinematics calculation, animations, and rich UI controls.
I will read index.html and src/index.css.
I will read src/index.css.
I will update index.html with a descriptive title, viewport settings, and Japanese typography support.
I will update src/index.css to add custom font utilities and nice scrollbar styling.
I will create src/types/index.ts to define types for physics, kinematics, customization, audio, and camera modes.
I will create src/physics/kinematics.ts containing the analytical 2-bone Inverse Kinematics solvers for legs and arms, bicycle steering geometry, and lean physics.
I will fix the unused variable warning in src/physics/kinematics.ts.
I will apply aeroTuck to forwardLean in src/physics/kinematics.ts.
I will create src/physics/bicyclePhysics.ts containing the vehicle dynamics simulation, gear ratios, aerodynamic drag, rolling resistance, slope gravity, freewheel ratchet logic, and spring-damper ear/basket physics.
I will fix the unused variable warnings in src/physics/bicyclePhysics.ts.
I will clean up unused local variables in src/physics/bicyclePhysics.ts.
I will remove the unused bumpFreq line.
I will create src/audio/soundManager.ts using the Web Audio API for procedural sound effects (bell, freewheel ratchet, tire rolling hum, wind, gear shift).
I will fix the unused variables in src/audio/soundManager.ts.
I will remove the unneeded references in src/audio/soundManager.ts.
I will remove speedRatio in src/audio/soundManager.ts.
I will create src/voxels/voxelBuilder.ts to provide voxel generation utilities, block matrix construction, materials cache, and geometric primitives.
I will create src/voxels/rabbitModel.ts containing the segmented voxel rabbit character, customizable fur colors, accessories, and IK bone positioning.
I will fix the TypeScript errors in src/voxels/rabbitModel.ts.
I will fix the argument counts for the goggle lenses in src/voxels/rabbitModel.ts.
I will create src/voxels/bicycleModel.ts containing the detailed voxel bicycle model, with rotating wheels, crankset, animated chain, steerable fork, front basket with carrots, and headlight.
I will fix the argument counts for voxel blocks in src/voxels/bicycleModel.ts.
I will fix the remaining argument counts in src/voxels/bicycleModel.ts.
I will create src/voxels/worldEnvironments.ts containing the 5 immersive 3D voxel environments, road splines, scenery objects (trees, buildings, lamps, bridges, rivers), particle systems, and sky/lighting presets.
I will fix the unused variables in src/voxels/worldEnvironments.ts.
I will update the rebuild and update methods in src/voxels/worldEnvironments.ts.
I will clean up update in src/voxels/worldEnvironments.ts.
I will use bikeSpeed in particle wind calculation in src/voxels/worldEnvironments.ts.
I will create src/components/ThreeCanvas.tsx to handle the WebGL rendering loop, camera modes, mouse/touch controls, lighting, and physics synchronization.
I will create src/components/HUD.tsx with speedometers, cadence gauges, gear shifter, force telemetry, on-screen controls, and status indicators.
I will create src/components/PhysicsVisualizer.tsx to display real-time 2D kinematic schematics, bone joint vectors, crank phase circles, and roll balance diagrams.
I will remove the unused import in src/components/PhysicsVisualizer.tsx.
I will create src/components/ControlPanel.tsx with camera view modes, environment tabs, time scale controls, auto-pilot toggle, and modal buttons.
I will create src/components/CustomizerModal.tsx to let users customize the rabbit's fur variety, accessories, and bicycle colors.
I will create src/components/HelpPhysicsModal.tsx explaining the mathematical formulas, kinematics algorithms, and vehicle physics implemented.
I will fix the JSX bracket escaping in src/components/HelpPhysicsModal.tsx.
I will create src/components/CarrotDeliveryGame.tsx providing the carrot delivery mini-game challenge.
I will implement src/App.tsx to connect the Three.js viewport, physics engine, keyboard input manager, HUD, and modal dialogs.
I will test build the project to verify that there are no compilation or bundling errors.
ユーザー様のご要望に基づき、ボクセルアート調の可愛い兎が自転車を漕ぐ、物理法則および逆運動学(IK)に厳密に基づいた3Dシミュレーターを制作いたしました。
🔬 物理的・運動学的に配慮した実装ポイント
-
2-Bone 逆運動学 (Closed-Loop IK) と脚部・ペダル拘束:
- クランク軸(BB)周りの円軌道(半径 16.5cm)に左右のペダルが 180∘ の位相差で回転。
- うさぎの両足裏は常にペダル表面に完全に固定され、サドル上の股関節からペダル位置までの距離に応じて**余弦定理(Law of Cosines)**に基づき膝関節の 3D 座標と大腿・下腿・足首の角度を毎フレーム解析的に算出(関節の外れや不自然な伸びを防止)。
- ペダルを踏み込む力点に合わせた骨盤(サドル)の微妙な傾きや上下動(ボビング)も再現。
-
ステアリングと腕部の逆運動学 (Arm IK):
- キャスター角(約 72∘)を持つフロントフォークの操舵に合わせてハンドルが回転し、うさぎの前足(肩 → 肘 手)がハンドルグリップを確実に握り続けるようリアルタイムに IK 計算。
🌟 搭載された機能・インタラクティブ要素
- 🎮 多彩な操作方法:
W / ↑ または画面ボタン: ペダリング加速
S / ↓ / Space: ブレーキ
A / D / ← / →: ステアリング操作
Q / E / 数字キー 1〜7: ギア変速
B: 自転車ベルを鳴らす(「チリンチリン🔔」)
L: フロント LED ヘッドライト点灯
C: カスタマイザーを開く / H: 物理解説モーダルを開く
- 🎥 6種類のカメラ視点:
- 追従カメラ(チェイスビュー)
- うさぎ目線 POV(ハンドル越しの一人称視点)
- IK 側面図(脚のクランク逆運動学を観察できる真横視点)
- 正面視点(うさぎの表情と耳の物理挙動を観察)
- アイソメトリック(クォータービュー俯瞰)
- 360° 自由回転(マウス/ドラッグで全方向から観察)
- 🌸 5つのボクセルワールド:
- 🌸 春の桜並木リバーサイド(川、桜の花びら、木製橋)
- 🍁 夕暮れの紅葉トレイル(黄金の紅葉、石灯籠、落ち葉)
- 🌃 ネオンサイバーシティ(光る看板、夜景ビル、サイバー街灯)
- ❄️ 白銀の雪原ロード(雪の針葉樹、雪だるま、降雪)
- 🪐 月面クレーターサーキット(重力 1/6: 1.62 m/s2・無気圧の宇宙空間!)
- 🎨 カスタマイザー:
- うさぎの品種・毛色(白うさぎ、ネザーランドドワーフ、ダッチツートン、垂れ耳ロップイヤー、ハニーゴールド、黒うさぎ)
- 衣装・アクセサリ(ヘルメット、麦わら帽子、ゴーグル、蝶ネクタイ、ニンジンリュック)
- 自転車カラー(ミントグリーン、コーラル、ロイヤルネイビー、レモンイエロー、ラベンダー、クロム)
- ⏱️ スローモーション & IK解析図:
0.25x / 0.5x / 1.0x / 一時停止で、脚の関節角度やペダル円運動を精密に観察可能
Files built: index.html, src/index.css, src/types/index.ts, src/physics/kinematics.ts, src/physics/bicyclePhysics.ts, src/audio/soundManager.ts, src/voxels/voxelBuilder.ts, src/voxels/rabbitModel.ts, src/voxels/bicycleModel.ts, src/voxels/worldEnvironments.ts, src/components/ThreeCanvas.tsx, src/components/HUD.tsx, src/components/PhysicsVisualizer.tsx, src/components/ControlPanel.tsx, src/components/CustomizerModal.tsx, src/components/HelpPhysicsModal.tsx, src/components/CarrotDeliveryGame.tsx, src/App.tsx