106 lines
3.4 KiB
Markdown
106 lines
3.4 KiB
Markdown
# LiDAR FPS Game - Setup Guide
|
|
|
|
## Project Structure Created:
|
|
- **Assets/Scripts/** - Your C# scripts (including FirstPersonController.cs)
|
|
- **Assets/Models/LidarScans/** - Where you'll import your GLB files
|
|
- **Assets/Prefabs/** - For reusable game objects
|
|
- **Assets/Scenes/** - Your game levels
|
|
|
|
## Step 1: Import Your GLB Files
|
|
|
|
1. Open Unity and your OGG project
|
|
2. Copy some GLB files from `K:\OGG\lidar\` to `K:\OGG\OGG\Assets\Models\LidarScans\`
|
|
- Start with one or two to test (e.g., "my bedroom.glb" or "studio old.glb")
|
|
3. Unity will automatically import them
|
|
|
|
## Step 2: Install glTFast Package (for better GLB support)
|
|
|
|
1. In Unity, go to **Window → Package Manager**
|
|
2. Click the **"+"** button in top-left
|
|
3. Select **"Add package by name"**
|
|
4. Enter: `com.atteneder.gltfast`
|
|
5. Click **Add**
|
|
|
|
## Step 3: Create Your Player
|
|
|
|
1. In the Hierarchy, **Right-click → Create Empty**
|
|
2. Rename it to "Player"
|
|
3. With Player selected, click **Add Component**
|
|
4. Search for and add: **Character Controller**
|
|
5. Add Component again, search for: **First Person Controller** (our script)
|
|
|
|
## Step 4: Set Up the Camera
|
|
|
|
1. In Hierarchy, **Right-click on Player → Camera**
|
|
2. Position the camera:
|
|
- Set Position Y to about 1.6 (eye height)
|
|
- Reset X and Z to 0
|
|
3. The FirstPersonController script should automatically find this camera
|
|
|
|
## Step 5: Import a LiDAR Scan into Your Scene
|
|
|
|
1. From Project window, navigate to **Assets/Models/LidarScans/**
|
|
2. Drag one of your GLB files into the Scene (Hierarchy)
|
|
3. Select the imported model in Hierarchy
|
|
4. In Inspector, click **Add Component → Mesh Collider**
|
|
- This allows the player to walk on it
|
|
5. You might need to adjust the scale:
|
|
- Try Scale: X=1, Y=1, Z=1 first
|
|
- If too big/small, adjust all values equally
|
|
|
|
## Step 6: Position Your Player
|
|
|
|
1. Select the Player in Hierarchy
|
|
2. In the Inspector, set Transform Position:
|
|
- Move the player above your scan (Y=2 or Y=3)
|
|
- Adjust X and Z to be inside the scan area
|
|
3. Make sure Character Controller settings are reasonable:
|
|
- Radius: 0.5
|
|
- Height: 2
|
|
- Center: Y=1
|
|
|
|
## Step 7: Test Your Game!
|
|
|
|
1. Click the **Play** button at the top
|
|
2. **Controls:**
|
|
- **WASD** or **Arrow Keys** - Move
|
|
- **Mouse** - Look around
|
|
- **Left Shift** - Run
|
|
- **Space** - Jump
|
|
- **Escape** - Unlock cursor
|
|
|
|
## Troubleshooting:
|
|
|
|
### Player falls through the floor:
|
|
- Make sure your LiDAR model has a **Mesh Collider** component
|
|
- Check that the Mesh Collider is enabled (checkbox ticked)
|
|
|
|
### Can't see anything:
|
|
- The camera might be inside geometry - move the Player position up (increase Y value)
|
|
- Check that the Camera is a child of Player and positioned at Y=1.6
|
|
|
|
### Movement feels weird:
|
|
- Adjust the Character Controller's Radius and Height
|
|
- Try different Walk/Run speeds in the FirstPersonController settings
|
|
|
|
### GLB files won't import:
|
|
- Install the glTFast package (see Step 2)
|
|
- Alternatively, you can convert GLB to OBJ using Blender if needed
|
|
|
|
## Next Steps:
|
|
|
|
Once you have basic movement working, we can add:
|
|
- Crosshair UI
|
|
- Health system
|
|
- Shooting mechanics
|
|
- Enemies/targets
|
|
- Multiple level loading
|
|
- Lighting improvements for your LiDAR scans
|
|
|
|
## Tips for LiDAR Scans:
|
|
|
|
- Your scans might be very detailed - this can slow down the game
|
|
- You may need to optimize them later (reduce polygon count)
|
|
- Start with smaller scans (single rooms) before loading larger areas
|
|
- You can have multiple scans in one scene to create larger levels
|