vr_video_camera/main_info.md

80 lines
2.8 KiB
Markdown
Raw Normal View History

2023-10-25 14:18:26 +00:00
### 1. Setup Development Environment:
#### a-1. Oculus Development Hub (ODH):
- Download and install the [Oculus Development Hub (ODH)](https://developer.oculus.com/documentation/unity/unity-odh/).
- Connect your Meta Quest 2 to your PC using a USB-C cable.
- Use ODH to enable Developer Mode on your Quest 2.
### a-2.
- Download and install the [Meta Quest Developer Hub (MQDH)](https://developer.oculus.com/downloads/package/oculus-developer-hub-win/)
- Connect your Meta Quest 2 to your PC using a USB-C cable.
- Use MQDH to enable Developer Mode on your Quest 2.
#### b. Unity Setup:
- Install [Unity Hub](https://unity3d.com/get-unity/download)
and then install Unity (preferably version 2019.4 or newer).
- Create a new Unity project.
- Go to `Asset Store` and download the `Oculus Integration` package.
- Import the package into your project.
#### c. Android SDK & NDK:
- Install [Android Studio](https://developer.android.com/studio).
- Open Android Studio, go to `SDK Manager`,
and ensure you have the required SDK and NDK versions installed.
### 2. USB OTG Camera Integration:
#### a. Android Manifest Permissions:
Add the necessary permissions to the AndroidManifest.xml:
```xml
<uses-permission android:name="android.permission.USB_HOST" />
<uses-feature android:name="android.hardware.usb.host" android:required="true" />
```
#### b. Accessing USB Camera:
You can use the [UVCCamera](https://github.com/saki4510t/UVCCamera) library.
Here's a basic way to integrate it:
1. Clone the UVCCamera repository.
2. Import the library into your Unity project.
3. Create a bridge class in Unity to interface with the library.
### 3. Display Camera Feed in VR:
#### a. Create a 3D Plane in Unity:
- In the Unity hierarchy, right-click and create a 3D Plane.
- This will be used to display the camera feed.
#### b. Display Camera Feed:
```csharp
public RawImage displayImage; // Drag your RawImage component here in the inspector
void UpdateCameraFeed(Texture cameraTexture)
{
displayImage.texture = cameraTexture;
}
```
### 4. User Interface & Controls:
#### a. Basic UI:
- Use Unity's UI system to create buttons for connecting/disconnecting the camera.
- Use Oculus Integration's `OVRInputModule` to make the UI interactive in VR.
#### b. VR Controls:
- Use the `OVRInput` class from Oculus Integration to detect button presses and controller movements.
### 5. Testing:
- Build and run your Unity project for the Android platform.
- Wear your Quest 2 and test the app's functionality.
### 6. Deployment:
- Follow Oculus' [submission guidelines](https://developer.oculus.com/distribute/latest/concepts/publish-submission-guidelines/) to submit your app to the Oculus Store.
### 7. Considerations:
- Regularly test with different USB OTG cameras to ensure broad compatibility.
- Monitor battery usage and optimize as necessary.