From 50ab06d73ea054df632c0a8369914be38352d548 Mon Sep 17 00:00:00 2001
From: Asaduji <39374509+Asaduji@users.noreply.github.com>
Date: Wed, 2 Apr 2025 23:16:03 +0200
Subject: [PATCH] Change ARVR Nodes default interpolation to off
---
doc/classes/ARVRAnchor.xml | 1 +
doc/classes/ARVRCamera.xml | 3 +++
doc/classes/ARVRController.xml | 1 +
scene/3d/arvr_nodes.cpp | 29 +++++++++++++++++++++++++++--
4 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml
index 836a32a9782..14353c3ff90 100644
--- a/doc/classes/ARVRAnchor.xml
+++ b/doc/classes/ARVRAnchor.xml
@@ -46,6 +46,7 @@
The anchor's ID. You can set this before the anchor itself exists. The first anchor gets an ID of [code]1[/code], the second an ID of [code]2[/code], etc. When anchors get removed, the engine can then assign the corresponding ID to new anchors. The most common situation where anchors "disappear" is when the AR server identifies that two anchors represent different parts of the same plane and merges them.
+
diff --git a/doc/classes/ARVRCamera.xml b/doc/classes/ARVRCamera.xml
index 4b1f72973f6..79cf89aad6e 100644
--- a/doc/classes/ARVRCamera.xml
+++ b/doc/classes/ARVRCamera.xml
@@ -12,6 +12,9 @@
+
+
+
diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml
index 5b4ec282109..c889e665e43 100644
--- a/doc/classes/ARVRController.xml
+++ b/doc/classes/ARVRController.xml
@@ -64,6 +64,7 @@
For any other controller that the [ARVRServer] detects, we continue with controller ID 3.
When a controller is turned off, its slot is freed. This ensures controllers will keep the same ID even when controllers with lower IDs are turned off.
+
The degree to which the controller vibrates. Ranges from [code]0.0[/code] to [code]1.0[/code]. If changed, updates [member ARVRPositionalTracker.rumble] accordingly.
This is a useful property to animate if you want the controller to vibrate for a limited duration.
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index a68360fb6d8..661365fb66c 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -69,6 +69,13 @@ String ARVRCamera::get_configuration_warning() const {
warning += TTR("ARVRCamera must have an ARVROrigin node as its parent.");
};
+ if (is_physics_interpolated()) {
+ if (warning != String()) {
+ warning += "\n\n";
+ }
+ warning += TTR("ARVRCamera should have physics_interpolation_mode set to OFF in order to avoid jitter.");
+ }
+
return warning;
};
@@ -172,8 +179,8 @@ Vector ARVRCamera::get_frustum() const {
return cm.get_projection_planes(get_camera_transform());
};
-ARVRCamera::ARVRCamera(){
- // nothing to do here yet for now..
+ARVRCamera::ARVRCamera() {
+ set_physics_interpolation_mode(Node::PHYSICS_INTERPOLATION_MODE_OFF);
};
ARVRCamera::~ARVRCamera(){
@@ -390,6 +397,13 @@ String ARVRController::get_configuration_warning() const {
warning += TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller.");
};
+ if (is_physics_interpolated()) {
+ if (warning != String()) {
+ warning += "\n\n";
+ }
+ warning += TTR("ARVRController should have physics_interpolation_mode set to OFF in order to avoid jitter.");
+ }
+
return warning;
};
@@ -397,6 +411,8 @@ ARVRController::ARVRController() {
controller_id = 1;
is_active = true;
button_states = 0;
+
+ set_physics_interpolation_mode(Node::PHYSICS_INTERPOLATION_MODE_OFF);
};
ARVRController::~ARVRController(){
@@ -524,6 +540,13 @@ String ARVRAnchor::get_configuration_warning() const {
warning += TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor.");
};
+ if (is_physics_interpolated()) {
+ if (warning != String()) {
+ warning += "\n\n";
+ }
+ warning += TTR("ARVRAnchor should have physics_interpolation_mode set to OFF in order to avoid jitter.");
+ }
+
return warning;
};
@@ -543,6 +566,8 @@ Ref ARVRAnchor::get_mesh() const {
ARVRAnchor::ARVRAnchor() {
anchor_id = 1;
is_active = true;
+
+ set_physics_interpolation_mode(Node::PHYSICS_INTERPOLATION_MODE_OFF);
};
ARVRAnchor::~ARVRAnchor(){