MIF_E31231623/android/wisata_app/AR_QUICKSTART.md

160 lines
3.4 KiB
Markdown

# AR Quick Start Guide
## Getting Started in 5 Minutes
### Step 1: Install Dependencies
```bash
cd android/wisata_app
flutter pub get
```
### Step 2: Run the Application
```bash
flutter run
```
### Step 3: Test AR Flow
1. **Login**: Use any credentials to access the app
2. **Go to Dashboard**: Select a destination
3. **View Details**: Tap on a destination card
4. **Enter AR**: Tap "View in Augmented Reality" button
5. **Scan Surface**: Move your phone to detect a flat surface
6. **Place Object**: Tap "Place Object" button
7. **Interact**: Use buttons to rotate, zoom, and manipulate
## AR Feature Quick Reference
### Access AR View
```dart
Navigator.pushNamed(context, '/ar', arguments: destination);
```
### Create AR Service
```dart
final arService = ArService(destination: destination);
```
### Place 3D Object
```dart
arService.placeObject(
objectId: 'unique_id',
modelPath: 'assets/models/model.glb',
objectName: 'Object Name',
);
```
### Handle Gestures
- **Pan**: Rotate object
- **Pinch**: Scale object
- **Tap**: Place or select object
### Available Controls
| Button | Action |
|--------|--------|
| Place Object | Add 3D model to scene |
| Rotate | Spin object around Y-axis |
| Zoom In | Increase object scale |
| Zoom Out | Decrease object scale |
| Reset | Return object to initial state |
| Delete | Remove all objects |
## File Structure
```
lib/
├── models/
│ ├── ar_object.dart # 3D object model
│ ├── ar_plane.dart # Surface plane model
│ ├── ar_scene.dart # Scene state model
│ └── destination.dart # Updated with AR fields
├── services/
│ ├── ar_service.dart # AR logic service
│ └── ar_utils.dart # Utility functions
└── screens/
└── ar_view_screen.dart # AR UI implementation
assets/
├── models/
│ ├── waterfall.glb # Sample model
│ ├── mountain.glb # Sample model
│ └── README.md # Model instructions
```
## Configuration
### Android Requirements
**Minimum SDK**: API 21+
**Target SDK**: API 33+
**ARCore**: Required
### Camera Permissions
The app automatically requests camera permission on first AR access.
### 3D Models
Place 3D models in `assets/models/` directory with `.glb` extension.
Update `destination_service.dart` to reference model:
```dart
arModelPath: 'assets/models/your_model.glb',
```
## Debugging
### Enable Debug Logs
```dart
ArUtils.logArOperation('Operation', 'Message');
```
### Check Performance
```dart
print(ArDebugInfo.getDebugInfo(...));
```
### Common Issues
**No planes detected?**
- Move phone slowly in different directions
- Ensure good lighting
- Try on textured surfaces
**Object not appearing?**
- Check model file path
- Verify GLB file integrity
- Ensure file is in assets
**Performance lag?**
- Reduce model polygon count
- Use fewer objects
- Optimize textures
## Next Steps
1. Add custom 3D models to `assets/models/`
2. Implement real ARCore integration in `ar_flutter_plugin`
3. Add physics-based interactions
4. Enable multi-object scene management
5. Implement object persistence
## Documentation
- **Full Guide**: `AR_IMPLEMENTATION_GUIDE.md`
- **3D Models**: `assets/models/README.md`
- **API Reference**: Code comments in `ar_service.dart`
## Support
Check the main AR implementation guide for detailed troubleshooting and advanced topics.