This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Unity VR snowboarding game built with HDRP (High Definition Render Pipeline) for Unity 2022.3.62f2. The project uses XR Interaction Toolkit 2.6.4 for VR functionality and includes player registration, scoring, and ranking systems with CSV-based data persistence.
Snowboard Physics (Assets/Scripts/SnowboardController.cs
)
- Physics-based snowboard movement using Rigidbody
- Ground detection with adjustable check distance
- Separate physics for ground vs. air (thrust only applies when grounded)
- Lateral forces for turning/carving with drift mechanics
- Dynamic drag and angular drag based on ground state
- Tilt-based rotation with carving effects
- Contains Turkish comments (iyi hareket, yanal hareket, etc.)
VR Player Stabilization (Assets/Scripts/VRRotationStabilizer.cs
)
- Camera stabilization for VR comfort
- Fixed height locking with smooth transitions
- Rotation damping on pitch/roll axes while preserving yaw
- Configurable comfort presets (Off, Light, Medium, High)
- Dead zone and rotation limits to prevent motion sickness
- Should be attached to XR Origin as child of snowboard
Player Data Management (Assets/Scripts/PlayerDataManager.cs
)
- CSV-based player registration (full name, phone, email)
- Saves to
Application.persistentDataPath/player_data.csv
- Uses PlayerPrefs to track current player session
- Updates score in CSV after game completion
- Handles scene transitions between Info and Beach scenes
- XRI input action support for VR controller (A button via "Scale Toggle" action)
Scoring System (Assets/Scripts/ScoreManager.cs
)
- Score tracking with combo system and multipliers
- Milestone rewards at predefined thresholds
- High score persistence via PlayerPrefs
- Animated score display
- Integrates with EndGameTrigger event to save final score
- Returns to "Info" scene after 5-second delay on game end
Ranking System (Assets/Scripts/RankManager.cs
)
- Reads player_data.csv and displays top 10 players
- Supports dual canvas display (two sets of 10 rank texts)
- Keeps highest score per player name
- Panel switching between rank view and registration form
- Space key toggles to registration panel
Game Flow
EndGameTrigger.cs
: Triggers game end event
TriggerZoneDetector.cs
: Detects zone entry/exit
CollectibleItem.cs
: Handles collectible scoring items
RelativeRespawnSystem.cs
: Respawn mechanics
CamFollow.cs
: Camera following logic
VRPlayerDamping.cs
: Additional VR smoothing
Audio
SnowboardSoundController.cs
: Snowboard audio feedback
Tools
SurfaceSnapTool.cs
: Editor tool for snapping objects to surfaces
PatternChildRemover.cs
: Utility for cleaning up patterns
Assets/Editor/TerrainRAWtoPNGConverter.cs
: Terrain heightmap conversion
- com.unity.render-pipelines.high-definition: 14.0.12 (HDRP)
- com.unity.xr.interaction.toolkit: 2.6.4 (VR interactions)
- com.unity.xr.openxr: 1.14.3 (VR platform support)
- com.unity.inputsystem: 1.14.0 (New Input System)
- com.unity.cinemachine: 2.10.3 (Camera control)
- com.unity.terrain-tools: 5.0.6 (Terrain editing)
- com.unity.textmeshpro: 3.0.7 (UI text)
Main scenes located in
Assets/Scenes/
:
- Info.unity: Main menu with player registration and rankings
- MainSnowboard.unity: Primary snowboard gameplay scene
- Snowboard.unity: Alternative gameplay scene
- Other test/sample scenes in subdirectories
- Epic Toon FX: Visual effects library (combat, magic, explosions, particles)
- ANGRY MESH Nature Pack - Winter Environment: Winter terrain assets with global snow/wind systems
- EasyRoads3D: Road generation system with HDRP support
- Rowlan Terrain/Stamps: Alpine mountain stamps for terrain tools
- XR Interaction Toolkit Starter Assets: Sample VR interaction scripts
- Unity 2022.3.62f2 is required
- The project uses HDRP, ensure graphics settings are configured for your target VR platform
- XR plugin management should be configured for OpenXR
- Use XR Device Simulator (part of XR Interaction Toolkit) for testing VR without a headset
- Debug GUI displays speed, ground state, tilt, and air time for snowboard
- ScoreManager and RankManager have
[ContextMenu]
test functions
- CSV file:
Application.persistentDataPath/player_data.csv
- On Windows standalone:
C:/Users/[username]/AppData/LocalLow/[CompanyName]/[ProductName]/
- On Android:
/storage/emulated/0/Android/data/[package]/files/
- Info scene: Player registers → saves to CSV → loads Beach scene
- Beach scene: Gameplay → collects items → reaches EndGameTrigger
- ScoreManager updates CSV with final score → returns to Info scene with rank panel visible
- Rigidbody mass: 80f (snowboarder weight)
- Max speed: 15 m/s (~54 km/h)
- Ground drag: 1f, Air drag: 0.5f
- Gravity multiplier: 1.5f for faster falls
- Ground layer: Configure in inspector to match terrain layer
- Ground check distance: 1f unit below board
- Default fixed height: 1.5m
- Recommended damping values: Pitch 0.05, Roll 0.05, Yaw 1.0
- Use comfort presets for different player sensitivity levels
- Turkish comments are present in some scripts (especially SnowboardController)
- Uses Unity's new Input System (InputAction, InputActionAsset)
- Event-driven architecture for game state (e.g.,
EndGameTrigger.OnGameEnded
)
- CSV parsing handles quoted fields and escaped characters
- PlayerPrefs used for session state and high scores
- Static methods used for cross-scene data updates (e.g.,
PlayerDataManager.UpdatePlayerScore
)
Edit
SnowboardController.cs
serialized fields:
thrustForce
: Forward acceleration
maxSpeed
: Speed cap
lateralForce
: Turning strength
tiltAngle
: Visual lean angle during turns
yawRotationSpeed
: Turn rate
Edit
CollectibleItem.cs
for individual item values
Edit
ScoreManager.cs
for milestones and combo multipliers
Use
VRRotationStabilizer.SetComfortPreset()
or adjust damping/limit values in inspector
Edit
PlayerDataManager.cs
if changing CSV structure
Update header in
CreateFileHeader()
and parsing logic in
ParseCSVLine()