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:
@@ -10,13 +10,9 @@ license = "MIT OR Apache-2.0"
|
||||
name = "bevy_openxr_android"
|
||||
crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[target.'cfg(not(target_os="android"))'.dependencies.bevy_oxr]
|
||||
path = "../../"
|
||||
default-features = true
|
||||
|
||||
|
||||
[dependencies]
|
||||
bevy_oxr = { path = "../..", default-features = false }
|
||||
bevy_oxr.path = "../.."
|
||||
bevy = "0.12"
|
||||
openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] }
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
|
||||
use bevy::prelude::*;
|
||||
use bevy::transform::components::Transform;
|
||||
use bevy_oxr::graphics::XrAppInfo;
|
||||
use bevy_oxr::xr_input::debug_gizmos::OpenXrDebugRenderer;
|
||||
use bevy_oxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig};
|
||||
use bevy_oxr::xr_input::trackers::{
|
||||
@@ -11,7 +12,12 @@ use bevy_oxr::DefaultXrPlugins;
|
||||
#[bevy_main]
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultXrPlugins)
|
||||
.add_plugins(DefaultXrPlugins {
|
||||
app_info: XrAppInfo {
|
||||
name: "Bevy OXR Android Example".into(),
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.add_plugins(OpenXrDebugRenderer)
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin)
|
||||
|
||||
@@ -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" }
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use bevy::diagnostic::LogDiagnosticsPlugin;
|
||||
use bevy::prelude::*;
|
||||
use bevy::transform::components::Transform;
|
||||
use bevy_oxr::graphics::XrAppInfo;
|
||||
use bevy_oxr::resources::XrViews;
|
||||
use bevy_oxr::xr_input::hands::common::{HandInputDebugRenderer, OpenXrHandInput};
|
||||
use bevy_oxr::xr_input::interactions::{
|
||||
@@ -19,7 +20,12 @@ fn main() {
|
||||
color_eyre::install().unwrap();
|
||||
|
||||
App::new()
|
||||
.add_plugins(DefaultXrPlugins)
|
||||
.add_plugins(DefaultXrPlugins {
|
||||
app_info: XrAppInfo {
|
||||
name: "Bevy OXR Globe Example".into(),
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (proto_locomotion, pull_to_ground).chain())
|
||||
|
||||
@@ -2,6 +2,7 @@ use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::transform::components::Transform;
|
||||
use bevy_oxr::graphics::XrAppInfo;
|
||||
use bevy_oxr::input::XrInput;
|
||||
use bevy_oxr::resources::{XrFrameState, XrSession};
|
||||
|
||||
@@ -25,7 +26,12 @@ fn main() {
|
||||
|
||||
info!("Running `openxr-6dof` skill");
|
||||
App::new()
|
||||
.add_plugins(DefaultXrPlugins)
|
||||
.add_plugins(DefaultXrPlugins {
|
||||
app_info: XrAppInfo {
|
||||
name: "Bevy OXR Example".into(),
|
||||
},
|
||||
..default()
|
||||
})
|
||||
//.add_plugins(OpenXrDebugRenderer) //new debug renderer adds gizmos to
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin)
|
||||
|
||||
Reference in New Issue
Block a user