3.4 KiB
3.4 KiB
AR Quick Start Guide
Getting Started in 5 Minutes
Step 1: Install Dependencies
cd android/wisata_app
flutter pub get
Step 2: Run the Application
flutter run
Step 3: Test AR Flow
- Login: Use any credentials to access the app
- Go to Dashboard: Select a destination
- View Details: Tap on a destination card
- Enter AR: Tap "View in Augmented Reality" button
- Scan Surface: Move your phone to detect a flat surface
- Place Object: Tap "Place Object" button
- Interact: Use buttons to rotate, zoom, and manipulate
AR Feature Quick Reference
Access AR View
Navigator.pushNamed(context, '/ar', arguments: destination);
Create AR Service
final arService = ArService(destination: destination);
Place 3D Object
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:
arModelPath: 'assets/models/your_model.glb',
Debugging
Enable Debug Logs
ArUtils.logArOperation('Operation', 'Message');
Check Performance
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
- Add custom 3D models to
assets/models/ - Implement real ARCore integration in
ar_flutter_plugin - Add physics-based interactions
- Enable multi-object scene management
- 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.