Input forwarding
Updated: Sep 16, 2024
It can be frustrating to constantly put your headset on and take it off during development. With input forwarding, you can move around your scene, click-and-drag on panels, and even grab objects in your 3D scene. All without needing to put on your headset.
Here’s a quick example of what it looks like in action:
Input forwarding is accessible through the cast functionality in Meta Quest Developer Hub (MQDH).
Download MQDH to get started. You must be on MQDH version 5.0 or later for this feature to work.
If you are starting with one of the sample projects, this has already been set up for you.
Add the meta-spatial-sdk-castinputforward
dependency
In your Spatial SDK app you can add input forwarding support by adding the following dependency in your app/build.gradle.kts
file:
implementation("com.meta.spatial:meta-spatial-sdk-castinputforward:$metaSpatialSdkVersion")
If you are using Groovy (build.gradle
):
implementation "com.meta.spatial:meta-spatial-sdk-castinputforward:$metaSpatialSdkVersion"
Verify your app has buildConfig
enabled
build.gradle.kts
:
android {
...
buildFeatures {
buildConfig = true
}
}
build.gradle
:
android {
...
buildFeatures {
buildConfig true
}
}
Modify your AndroidManifest.xml
In your manifest file, add the following uses-native-library
tag under the <application>
section:
<application>
...
<uses-native-library
android:name="libossdk.oculus.so"
android:required="true"
/>
</application>
Add the CastInputForwardFeature
to your base immersive activity
override fun registerFeatures(): List<SpatialFeature> {
var features = ...
+ if (BuildConfig.DEBUG) {
+ features.add(CastInputForwardFeature(this))
+ }
return features
}
CastInputForwardFeature
is only useful during development and so you should not release an app with it included. This is why the BuildConfig.DEBUG
check is being made.
Connect your headset
Make sure it shows up in MQDH.
Start casting with MQDH
Run your app
Make sure that you’re building a DEBUG flavor, and run your app in Android Studio.
Select the input forward icon while inside of your app to enable input forwarding.
Casting with input forwarding only works with your resolution set to “Original (1:1)”, it will not work correctly if your resolution is set to “Cropped (16:9)” or “Cinematic (16:9)”.
Key | Action |
---|
W / Up Arrow | Move forward |
S / Down Arrow | Move backward |
A | Move left |
D | Move right |
Q | Move up |
E | Move down |
Left Arrow | Rotate left |
Right Arrow | Rotate right |
Shift | Sprint |
Left mouse button | Click |
Ctrl + Left mouse button / Right mouse button | Hold to rotate view |
Space + Left mouse button | Grab |
Line colors:
- Green: Cursor is within range to interact
- Red: Cursor is out of range to interact
- Blue: Clicking
- Yellow: Grab mode enabled
Example of grabbing (notice the cursor turn yellow when Space is held down):
Note: The intersecting lines in your scene signify where clicks/grabs will actually be sent into the 3D scene. This may not line up perfectly with where your mouse cursor is on the Cast window.
Please verify:
- You are on MQDH version 5.0
- You have followed all the steps to include input forwarding to your app, this must be added per-app.
CastInputForwardFeature
should be one of the features you return in registerFeatures()
Not seeing the intersecting lines means you are in general input forwarding mode, and not the Spatial SDK specific input forwarding mode. This is commonly fixed by restarting your app and selecting the input forward icon in your Cast window again. In rare cases you may need to restart your Cast window as well.
Make sure you have added the <uses-native-library>
tag for libossdk, mentioned above in the “Adding input forwarding” section.