make app close when requested by os and other stuff (#61)

* idk

* mr stuff

* done

* fix windows

* add patches to Readme
This commit is contained in:
Schmarni
2024-01-01 00:35:59 +01:00
committed by GitHub
parent fcedb9c0c8
commit 65a30cac3c
22 changed files with 666 additions and 165 deletions

View File

@@ -10,12 +10,21 @@ crate-type = ["rlib", "cdylib"]
[dependencies]
bevy = "0.12"
bevy_oxr = { path = "../../", default-features = false }
bevy_oxr.path = "../../"
bevy_rapier3d = { git = "https://github.com/devil-ira/bevy_rapier", branch = "bevy-0.12" }
color-eyre = "0.6.2"
[target.'cfg(not(target_os="android"))'.dependencies.bevy_oxr]
path = "../../"
# May need to be more specific. needs to be false at least on linux without an active runtime to run in flat
default-features = true
# [target.'cfg(not(target_os="android"))'.dependencies.bevy_oxr]
# path = "../../"
# # May need to be more specific. needs to be false at least on linux without an active runtime to run in flat
# default-features = true
[profile.release]
debug = true
[patch.crates-io]
ndk = { git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" }
ndk-sys = { package = "ndk-sys", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" }
ndk-context = { package = "ndk-context", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" }
ndk-glue = { package = "ndk-glue", git = "https://github.com/Schmarni-Dev/ndk.git", branch = "070" }

View File

@@ -3,13 +3,14 @@ android:
- "runtime_libs"
manifest:
package: "org.bevyengine.demo_openxr_android"
# Are features and permissions fliped?
uses_feature:
- name: "android.hardware.vr.headtracking"
required: true
- name: "oculus.software.handtracking"
required: false
- name: "com.oculus.experimental.enabled"
required: true
# - name: "com.oculus.feature.PASSTHROUGH"
# required: true
uses_permission:
- name: "com.oculus.permission.HAND_TRACKING"
application:

View File

@@ -16,9 +16,10 @@ use bevy::{
transform::TransformSystem,
};
use bevy_oxr::{
graphics::{extensions::XrExtensions, XrAppInfo, XrPreferdBlendMode},
input::XrInput,
xr_init::{XrEnableRequest, XrEnableStatus, xr_only},
resources::{XrFrameState, XrInstance, XrSession},
xr_init::{xr_only, XrEnableRequest, XrEnableStatus},
xr_input::{
actions::XrActionSets,
debug_gizmos::OpenXrDebugRenderer,
@@ -31,7 +32,10 @@ use bevy_oxr::{
},
oculus_touch::OculusController,
prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig},
trackers::{OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker},
trackers::{
OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker,
OpenXRTrackingRoot,
},
Hand,
},
DefaultXrPlugins,
@@ -61,13 +65,20 @@ pub fn main() {
info!("Running bevy_openxr demo");
let mut app = App::new();
let mut xr_extensions = XrExtensions::default();
app.add_systems(Update, input_stuff)
//lets get the usual diagnostic stuff added
.add_plugins(LogDiagnosticsPlugin::default())
.add_plugins(FrameTimeDiagnosticsPlugin)
//lets get the xr defaults added
.add_plugins(DefaultXrPlugins)
.add_plugins(DefaultXrPlugins {
reqeusted_extensions: xr_extensions,
prefered_blend_mode: XrPreferdBlendMode::Opaque,
app_info: XrAppInfo {
name: "Bevy OXR Demo".into(),
},
})
//lets add the debug renderer for the controllers
.add_plugins(OpenXrDebugRenderer)
//rapier goes here
@@ -93,7 +104,9 @@ pub fn main() {
//draw the interaction gizmos
.add_systems(
Update,
draw_interaction_gizmos.run_if(xr_only()).after(update_interactable_states),
draw_interaction_gizmos
.run_if(xr_only())
.after(update_interactable_states),
)
.add_systems(Update, draw_socket_gizmos.after(update_interactable_states))
//add our cube spawning system

View File

@@ -8,7 +8,7 @@ use bevy::{
};
use bevy_oxr::xr_input::interactions::{Touched, XRInteractable, XRInteractableState};
use bevy_rapier3d::{
prelude::{Collider, RigidBody, Group, CollisionGroups},
prelude::{Collider, CollisionGroups, Group, RigidBody},
render::ColliderDebugColor,
};
@@ -67,7 +67,7 @@ pub fn setup_scene(
// });
// camera
commands.spawn((Camera3dBundle {
transform: Transform::from_xyz(0.25, 1.25, 0.0).looking_at(
transform: Transform::from_xyz(5.25, 5.25, 5.0).looking_at(
Vec3 {
x: -0.548,
y: -0.161,