mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Merge pull request #99159 from BastiaanOlij/openxr_fix_recenter_logic
OpenXR: Fix pose recenter signal to be omitted properly
This commit is contained in:
commit
318fe5f9ec
@ -2036,8 +2036,9 @@ bool OpenXRAPI::poll_events() {
|
|||||||
if (local_floor_emulation.enabled) {
|
if (local_floor_emulation.enabled) {
|
||||||
local_floor_emulation.should_reset_floor_height = true;
|
local_floor_emulation.should_reset_floor_height = true;
|
||||||
}
|
}
|
||||||
if (event->poseValid && xr_interface) {
|
|
||||||
xr_interface->on_pose_recentered();
|
if (xr_interface) {
|
||||||
|
xr_interface->on_reference_space_change_pending();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: {
|
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: {
|
||||||
|
@ -1134,6 +1134,12 @@ void OpenXRInterface::process() {
|
|||||||
if (head.is_valid()) {
|
if (head.is_valid()) {
|
||||||
head->set_pose("default", head_transform, head_linear_velocity, head_angular_velocity, head_confidence);
|
head->set_pose("default", head_transform, head_linear_velocity, head_angular_velocity, head_confidence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reference_stage_changing) {
|
||||||
|
// Now that we have updated tracking information in our updated reference space, trigger our pose recentered signal.
|
||||||
|
emit_signal(SNAME("pose_recentered"));
|
||||||
|
reference_stage_changing = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenXRInterface::pre_render() {
|
void OpenXRInterface::pre_render() {
|
||||||
@ -1315,8 +1321,8 @@ void OpenXRInterface::on_state_exiting() {
|
|||||||
emit_signal(SNAME("instance_exiting"));
|
emit_signal(SNAME("instance_exiting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenXRInterface::on_pose_recentered() {
|
void OpenXRInterface::on_reference_space_change_pending() {
|
||||||
emit_signal(SNAME("pose_recentered"));
|
reference_stage_changing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenXRInterface::on_refresh_rate_changes(float p_new_rate) {
|
void OpenXRInterface::on_refresh_rate_changes(float p_new_rate) {
|
||||||
|
@ -70,6 +70,7 @@ class OpenXRInterface : public XRInterface {
|
|||||||
private:
|
private:
|
||||||
OpenXRAPI *openxr_api = nullptr;
|
OpenXRAPI *openxr_api = nullptr;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
bool reference_stage_changing = false;
|
||||||
XRInterface::TrackingStatus tracking_state;
|
XRInterface::TrackingStatus tracking_state;
|
||||||
|
|
||||||
// At a minimum we need a tracker for our head
|
// At a minimum we need a tracker for our head
|
||||||
@ -207,7 +208,7 @@ public:
|
|||||||
void on_state_stopping();
|
void on_state_stopping();
|
||||||
void on_state_loss_pending();
|
void on_state_loss_pending();
|
||||||
void on_state_exiting();
|
void on_state_exiting();
|
||||||
void on_pose_recentered();
|
void on_reference_space_change_pending();
|
||||||
void on_refresh_rate_changes(float p_new_rate);
|
void on_refresh_rate_changes(float p_new_rate);
|
||||||
void tracker_profile_changed(RID p_tracker, RID p_interaction_profile);
|
void tracker_profile_changed(RID p_tracker, RID p_interaction_profile);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user