From 5b44eaddfa70820890b536321ec4235b2a1ab1a8 Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Mon, 21 Nov 2022 20:40:13 -0500 Subject: [PATCH] Add mounting reset (two-pose reset) (#251) --- src/main/java/com/jme3/math/FastMath.java | 64 ++++++++++++-- src/main/java/com/jme3/math/Quaternion.java | 4 +- src/main/java/dev/slimevr/VRServer.java | 6 ++ .../dev/slimevr/config/KeybindingsConfig.java | 6 ++ src/main/java/dev/slimevr/gui/Keybinding.java | 9 ++ .../java/dev/slimevr/gui/TrackersList.java | 21 ++++- .../java/dev/slimevr/gui/VRServerGUI.java | 18 ++++ .../poserecorder/PoseFrameTracker.java | 5 ++ .../slimevr/poserecorder/TrackerFrame.java | 5 ++ .../java/dev/slimevr/protocol/RPCHandler.java | 2 + .../vr/processor/HumanPoseProcessor.java | 6 ++ .../vr/processor/skeleton/HumanSkeleton.java | 32 +++++++ .../vr/processor/skeleton/Skeleton.java | 3 + .../slimevr/vr/trackers/ComputedTracker.java | 4 + .../dev/slimevr/vr/trackers/IMUTracker.java | 4 + .../vr/trackers/ReferenceAdjustedTracker.java | 87 +++++++++++++------ .../java/dev/slimevr/vr/trackers/Tracker.java | 2 + 17 files changed, 242 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/jme3/math/FastMath.java b/src/main/java/com/jme3/math/FastMath.java index ed0917d14..89be15977 100644 --- a/src/main/java/com/jme3/math/FastMath.java +++ b/src/main/java/com/jme3/math/FastMath.java @@ -70,9 +70,59 @@ final public class FastMath { public static final float DEG_TO_RAD = PI / 180.0f; /** A value to multiply a radian value by, to convert it to degrees. */ public static final float RAD_TO_DEG = 180.0f / PI; - /** A precreated random object for random numbers. */ + /** A premade random object for random numbers. */ public static final Random rand = new Random(System.currentTimeMillis()); + /** + * Returns true if the number is within the specified {@code tolerance} + * value. + * + * @param value The number to check. + * @param tolerance The tolerance to zero (must be positive). + * @return True if the number is within the specified {@code tolerance} + * value. + */ + public static boolean isApproxZero(float value, float tolerance) { + return value < tolerance && value > tolerance; + } + + /** + * Returns true if the number is within the {@link #ZERO_TOLERANCE} value. + * + * @param value The number to check. + * @return True if the number is within the {@link #ZERO_TOLERANCE} value. + */ + public static boolean isApproxZero(float value) { + return isApproxZero(value, ZERO_TOLERANCE); + } + + /** + * Returns true if the two numbers are equal within the specified + * {@code tolerance} value. + * + * @param valueOne The first number to check. + * @param valueTwo The second number to check. + * @param tolerance The tolerance to zero (must be positive). + * @return True if the numbers are approximately equal within the specified + * {@code tolerance} value. + */ + public static boolean isApproxEqual(float valueOne, float valueTwo, float tolerance) { + return isApproxZero(valueTwo - valueOne, tolerance); + } + + /** + * Returns true if the two numbers are equal within the + * {@link #ZERO_TOLERANCE} value. + * + * @param valueOne The first number to check. + * @param valueTwo The second number to check. + * @return True if the numbers are approximately equal within the + * {@link #ZERO_TOLERANCE} value. + */ + public static boolean isApproxEqual(float valueOne, float valueTwo) { + return isApproxEqual(valueOne, valueTwo, ZERO_TOLERANCE); + } + /** * Returns true if the number is a power of 2 (2,4,8,16...) * @@ -99,7 +149,7 @@ final public class FastMath { * * @param scale scale value to use. if 1, use endValue, if 0, use * startValue. - * @param startValue Begining value. 0% of f + * @param startValue Beginning value. 0% of f * @param endValue ending value. 100% of f * @return The interpolated value between startValue and endValue. */ @@ -122,7 +172,7 @@ final public class FastMath { * * @param scale scale value to use. if 1, use endValue, if 0, use * startValue. - * @param startValue Begining value. 0% of f + * @param startValue Beginning value. 0% of f * @param endValue ending value. 100% of f * @param store a vector3f to store the result * @return The interpolated value between startValue and endValue. @@ -148,7 +198,7 @@ final public class FastMath { * * @param scale scale value to use. if 1, use endValue, if 0, use * startValue. - * @param startValue Begining value. 0% of f + * @param startValue Beginning value. 0% of f * @param endValue ending value. 100% of f * @return The interpolated value between startValue and endValue. */ @@ -392,7 +442,7 @@ final public class FastMath { } /** - * Compute the lenght on a catmull rom spline between control point 1 and 2 + * Compute the length on a catmull rom spline between control point 1 and 2 * * @param p0 control point 0 * @param p1 control point 1 @@ -437,7 +487,7 @@ final public class FastMath { } /** - * Compute the lenght on a bezier spline between control point 1 and 2 + * Compute the length on a bezier spline between control point 1 and 2 * * @param p0 control point 0 * @param p1 control point 1 @@ -657,7 +707,7 @@ final public class FastMath { /** * Returns the value squared. fValue ^ 2 * - * @param fValue The vaule to square. + * @param fValue The value to square. * @return The square of the given value. */ public static float sqr(float fValue) { diff --git a/src/main/java/com/jme3/math/Quaternion.java b/src/main/java/com/jme3/math/Quaternion.java index 460095856..d83718be5 100644 --- a/src/main/java/com/jme3/math/Quaternion.java +++ b/src/main/java/com/jme3/math/Quaternion.java @@ -279,7 +279,7 @@ public final class Quaternion implements Cloneable, java.io.Serializable { /** * toAngles returns this quaternion converted to Euler rotation - * angles (yaw,roll,pitch).
+ * angles (pitch, yaw, roll).
* Note that the result is not always 100% accurate due to the implications * of euler angles. * @@ -288,7 +288,7 @@ public final class Quaternion implements Cloneable, java.io.Serializable { * * @param angles the float[] in which the angles should be stored, or null * if you want a new float[] to be created - * @return the float[] in which the angles are stored. + * @return the float[] in which the angles are stored (pitch, yaw, roll). */ public float[] toAngles(float[] angles) { if (angles == null) { diff --git a/src/main/java/dev/slimevr/VRServer.java b/src/main/java/dev/slimevr/VRServer.java index c2d0841f5..d6bcaf622 100644 --- a/src/main/java/dev/slimevr/VRServer.java +++ b/src/main/java/dev/slimevr/VRServer.java @@ -251,6 +251,12 @@ public class VRServer extends Thread { queueTask(humanPoseProcessor::resetTrackers); } + public void resetTrackersMounting() { + queueTask(() -> { + humanPoseProcessor.resetTrackersMounting(); + }); + } + public void resetTrackersYaw() { queueTask(humanPoseProcessor::resetTrackersYaw); } diff --git a/src/main/java/dev/slimevr/config/KeybindingsConfig.java b/src/main/java/dev/slimevr/config/KeybindingsConfig.java index eb3f40482..b19fc0c2d 100644 --- a/src/main/java/dev/slimevr/config/KeybindingsConfig.java +++ b/src/main/java/dev/slimevr/config/KeybindingsConfig.java @@ -6,6 +6,8 @@ public class KeybindingsConfig { private String quickResetBinding = "CTRL+ALT+SHIFT+U"; + private String resetMountingBinding = "CTRL+ALT+SHIFT+I"; + public KeybindingsConfig() { } @@ -16,4 +18,8 @@ public class KeybindingsConfig { public String getQuickResetBinding() { return quickResetBinding; } + + public String getResetMountingBinding() { + return resetMountingBinding; + } } diff --git a/src/main/java/dev/slimevr/gui/Keybinding.java b/src/main/java/dev/slimevr/gui/Keybinding.java index 534d7ce51..764735530 100644 --- a/src/main/java/dev/slimevr/gui/Keybinding.java +++ b/src/main/java/dev/slimevr/gui/Keybinding.java @@ -12,6 +12,7 @@ import io.eiren.util.logging.LogManager; public class Keybinding implements HotkeyListener { private static final int RESET = 1; private static final int QUICK_RESET = 2; + private static final int RESET_MOUNTING = 3; public final VRServer server; @@ -42,6 +43,10 @@ public class Keybinding implements HotkeyListener { String quickResetBinding = this.config.getQuickResetBinding(); JIntellitype.getInstance().registerHotKey(QUICK_RESET, quickResetBinding); LogManager.info("[Keybinding] Bound quick reset to " + quickResetBinding); + + String resetMountingBinding = this.config.getResetMountingBinding(); + JIntellitype.getInstance().registerHotKey(RESET_MOUNTING, resetMountingBinding); + LogManager.info("[Keybinding] Bound reset mounting to " + resetMountingBinding); } } catch (Throwable e) { LogManager @@ -63,6 +68,10 @@ public class Keybinding implements HotkeyListener { LogManager.info("[Keybinding] Quick reset pressed"); server.resetTrackersYaw(); } + case RESET_MOUNTING -> { + LogManager.info("[Keybinding] Reset mounting pressed"); + server.resetTrackersMounting(); + } } } } diff --git a/src/main/java/dev/slimevr/gui/TrackersList.java b/src/main/java/dev/slimevr/gui/TrackersList.java index 1e0dfd70a..6f84e7470 100644 --- a/src/main/java/dev/slimevr/gui/TrackersList.java +++ b/src/main/java/dev/slimevr/gui/TrackersList.java @@ -142,6 +142,7 @@ public class TrackersList extends EJBoxNoStretch { JLabel adj; JLabel adjYaw; JLabel adjGyro; + JLabel adjMounting; JLabel correction; JLabel signalStrength; JLabel rotQuat; @@ -345,10 +346,15 @@ public class TrackersList extends EJBoxNoStretch { adjGyro = new JLabel("0 0 0 0"), c(1, row, 2, GridBagConstraints.FIRST_LINE_START) ); - add(new JLabel("Temp:"), c(2, row, 2, GridBagConstraints.FIRST_LINE_START)); + add(new JLabel("Mount Fix:"), c(2, row, 2, GridBagConstraints.FIRST_LINE_START)); + add( + adjMounting = new JLabel("0 0 0 0"), + c(3, row, 2, GridBagConstraints.FIRST_LINE_START) + ); + add(new JLabel("Temp:"), c(4, row, 2, GridBagConstraints.FIRST_LINE_START)); add( temperature = new JLabel("?"), - c(3, row, 2, GridBagConstraints.FIRST_LINE_START) + c(5, row, 2, GridBagConstraints.FIRST_LINE_START) ); } @@ -446,6 +452,17 @@ public class TrackersList extends EJBoxNoStretch { + StringUtils.prettyNumber(angles[2] * FastMath.RAD_TO_DEG, 0) ); } + if (adjMounting != null) { + rat.mountRotFix.toAngles(angles); + adjMounting + .setText( + StringUtils.prettyNumber(angles[0] * FastMath.RAD_TO_DEG, 0) + + " " + + StringUtils.prettyNumber(angles[1] * FastMath.RAD_TO_DEG, 0) + + " " + + StringUtils.prettyNumber(angles[2] * FastMath.RAD_TO_DEG, 0) + ); + } } if (tracker instanceof TrackerWithWireless) { diff --git a/src/main/java/dev/slimevr/gui/VRServerGUI.java b/src/main/java/dev/slimevr/gui/VRServerGUI.java index ebb852eb0..ca51565ce 100644 --- a/src/main/java/dev/slimevr/gui/VRServerGUI.java +++ b/src/main/java/dev/slimevr/gui/VRServerGUI.java @@ -43,6 +43,7 @@ public class VRServerGUI extends JFrame { private final SkeletonList skeletonList; private final EJBox pane; private JButton resetButton; + private JButton resetMountingButton; private JButton floorClipButton; private JButton skatingCorrectionButton; @@ -199,6 +200,17 @@ public class VRServerGUI extends JFrame { } }); add(Box.createHorizontalStrut(10)); + add(resetMountingButton = new JButton("Reset Mounting") { + { + addMouseListener(new MouseInputAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + resetMounting(); + } + }); + } + }); + add(Box.createHorizontalStrut(10)); add(new JButton("Fast Reset") { { addMouseListener(new MouseInputAdapter() { @@ -544,6 +556,12 @@ public class VRServerGUI extends JFrame { ButtonTimer.runTimer(resetButton, 3, "RESET", server::resetTrackers); } + @AWTThread + private void resetMounting() { + ButtonTimer + .runTimer(resetMountingButton, 3, "Reset Mounting", server::resetTrackersMounting); + } + @AWTThread private void setSkatingReductionEnabled(Boolean value) { if (value == null) diff --git a/src/main/java/dev/slimevr/poserecorder/PoseFrameTracker.java b/src/main/java/dev/slimevr/poserecorder/PoseFrameTracker.java index 75cce92e2..4a9bdf74a 100644 --- a/src/main/java/dev/slimevr/poserecorder/PoseFrameTracker.java +++ b/src/main/java/dev/slimevr/poserecorder/PoseFrameTracker.java @@ -207,6 +207,11 @@ public class PoseFrameTracker implements Tracker, Iterable { throw new UnsupportedOperationException("PoseFrameTracker does not implement calibration"); } + @Override + public void resetMounting(boolean reverseYaw) { + throw new UnsupportedOperationException("PoseFrameTracker does not implement calibration"); + } + @Override public void tick() { throw new UnsupportedOperationException("PoseFrameTracker does not implement this method"); diff --git a/src/main/java/dev/slimevr/poserecorder/TrackerFrame.java b/src/main/java/dev/slimevr/poserecorder/TrackerFrame.java index 19e0a21d4..501e93e7f 100644 --- a/src/main/java/dev/slimevr/poserecorder/TrackerFrame.java +++ b/src/main/java/dev/slimevr/poserecorder/TrackerFrame.java @@ -146,6 +146,11 @@ public final class TrackerFrame implements Tracker { throw new UnsupportedOperationException("TrackerFrame does not implement calibration"); } + @Override + public void resetMounting(boolean reverseYaw) { + throw new UnsupportedOperationException("TrackerFrame does not implement calibration"); + } + @Override public void tick() { throw new UnsupportedOperationException("TrackerFrame does not implement this method"); diff --git a/src/main/java/dev/slimevr/protocol/RPCHandler.java b/src/main/java/dev/slimevr/protocol/RPCHandler.java index 5b5ea942c..14d3d8116 100644 --- a/src/main/java/dev/slimevr/protocol/RPCHandler.java +++ b/src/main/java/dev/slimevr/protocol/RPCHandler.java @@ -247,6 +247,8 @@ public class RPCHandler extends ProtocolHandler this.api.server.resetTrackersYaw(); if (req.resetType() == ResetType.Full) this.api.server.resetTrackers(); + if (req.resetType() == ResetType.Mounting) + this.api.server.resetTrackersMounting(); LogManager.severe("[WebSocketAPI] Reset performed"); } diff --git a/src/main/java/dev/slimevr/vr/processor/HumanPoseProcessor.java b/src/main/java/dev/slimevr/vr/processor/HumanPoseProcessor.java index 0512c5b6a..17ee769e1 100644 --- a/src/main/java/dev/slimevr/vr/processor/HumanPoseProcessor.java +++ b/src/main/java/dev/slimevr/vr/processor/HumanPoseProcessor.java @@ -199,6 +199,12 @@ public class HumanPoseProcessor { } } + @VRServerThread + public void resetTrackersMounting() { + if (skeleton != null) + skeleton.resetTrackersMounting(); + } + @VRServerThread public void resetTrackersYaw() { if (skeleton != null) diff --git a/src/main/java/dev/slimevr/vr/processor/skeleton/HumanSkeleton.java b/src/main/java/dev/slimevr/vr/processor/skeleton/HumanSkeleton.java index 932260870..ae538f5c0 100644 --- a/src/main/java/dev/slimevr/vr/processor/skeleton/HumanSkeleton.java +++ b/src/main/java/dev/slimevr/vr/processor/skeleton/HumanSkeleton.java @@ -1781,6 +1781,38 @@ public class HumanSkeleton extends Skeleton implements SkeletonConfigCallback { this.legTweaks.resetBuffer(); } + private boolean shouldResetMounting(TrackerPosition position) { + return position != null + // TODO: Feet can't currently be reset using this method, maybe + // they'll need a separate step just for them? + && position != TrackerPosition.LEFT_FOOT + && position != TrackerPosition.RIGHT_FOOT; + } + + private boolean shouldReverseYaw(TrackerPosition position) { + return position != null + && (position == TrackerPosition.LEFT_UPPER_LEG + || position == TrackerPosition.RIGHT_UPPER_LEG + || position == TrackerPosition.LEFT_LOWER_ARM + || position == TrackerPosition.RIGHT_LOWER_ARM + || position == TrackerPosition.LEFT_HAND + || position == TrackerPosition.RIGHT_HAND); + } + + @Override + @VRServerThread + public void resetTrackersMounting() { + // Pass all trackers through trackerPreUpdate + Tracker[] trackersToReset = getTrackersToReset(); + + for (Tracker tracker : trackersToReset) { + if (tracker != null && shouldResetMounting(tracker.getBodyPosition())) { + tracker.resetMounting(shouldReverseYaw(tracker.getBodyPosition())); + } + } + this.legTweaks.resetBuffer(); + } + @Override @VRServerThread public void resetTrackersYaw() { diff --git a/src/main/java/dev/slimevr/vr/processor/skeleton/Skeleton.java b/src/main/java/dev/slimevr/vr/processor/skeleton/Skeleton.java index 633f8a983..5ef5656c2 100644 --- a/src/main/java/dev/slimevr/vr/processor/skeleton/Skeleton.java +++ b/src/main/java/dev/slimevr/vr/processor/skeleton/Skeleton.java @@ -37,6 +37,9 @@ public abstract class Skeleton { @VRServerThread public abstract void resetTrackersFull(); + @VRServerThread + public abstract void resetTrackersMounting(); + @VRServerThread public abstract void resetTrackersYaw(); diff --git a/src/main/java/dev/slimevr/vr/trackers/ComputedTracker.java b/src/main/java/dev/slimevr/vr/trackers/ComputedTracker.java index 57a35fcc4..ac86bda6d 100644 --- a/src/main/java/dev/slimevr/vr/trackers/ComputedTracker.java +++ b/src/main/java/dev/slimevr/vr/trackers/ComputedTracker.java @@ -108,6 +108,10 @@ public class ComputedTracker implements Tracker, TrackerWithTPS { public void resetYaw(Quaternion reference) { } + @Override + public void resetMounting(boolean reverseYaw) { + } + @Override public TrackerPosition getBodyPosition() { return bodyPosition; diff --git a/src/main/java/dev/slimevr/vr/trackers/IMUTracker.java b/src/main/java/dev/slimevr/vr/trackers/IMUTracker.java index 44a9cd789..249e39c67 100644 --- a/src/main/java/dev/slimevr/vr/trackers/IMUTracker.java +++ b/src/main/java/dev/slimevr/vr/trackers/IMUTracker.java @@ -277,6 +277,10 @@ public class IMUTracker // TODO Print "jump" length when correcting if it's more than 1 degree } + @Override + public void resetMounting(boolean reverseYaw) { + } + @Override public TrackerPosition getBodyPosition() { return bodyPosition; diff --git a/src/main/java/dev/slimevr/vr/trackers/ReferenceAdjustedTracker.java b/src/main/java/dev/slimevr/vr/trackers/ReferenceAdjustedTracker.java index aff4b7466..f09921fe4 100644 --- a/src/main/java/dev/slimevr/vr/trackers/ReferenceAdjustedTracker.java +++ b/src/main/java/dev/slimevr/vr/trackers/ReferenceAdjustedTracker.java @@ -1,5 +1,6 @@ package dev.slimevr.vr.trackers; +import com.jme3.math.FastMath; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import dev.slimevr.config.TrackerConfig; @@ -9,9 +10,15 @@ import dev.slimevr.vr.Device; public class ReferenceAdjustedTracker implements Tracker { public final E tracker; - public final Quaternion yawFix = new Quaternion(); + + // Vector for mounting rotation correction (tilt direction) + public final Vector3f rotVector = new Vector3f(); + public final Quaternion gyroFix = new Quaternion(); public final Quaternion attachmentFix = new Quaternion(); + public final Quaternion mountRotFix = new Quaternion(); + public final Quaternion yawFix = new Quaternion(); + protected float confidenceMultiplier = 1.0f; public ReferenceAdjustedTracker(E tracker) { @@ -34,8 +41,8 @@ public class ReferenceAdjustedTracker implements Tracker { } /** - * Reset the tracker so that it's current rotation is counted as (0, , 0). This allows tracker to be strapped to body at any pitch and + * Reset the tracker so that its current rotation is counted as (0, , 0). This allows the tracker to be strapped to body at any pitch and * roll. *

* Performs {@link #resetYaw(Quaternion)} for yaw drift correction. @@ -43,12 +50,12 @@ public class ReferenceAdjustedTracker implements Tracker { @Override public void resetFull(Quaternion reference) { tracker.resetFull(reference); - fixGyroscope(); Quaternion sensorRotation = new Quaternion(); tracker.getRotation(sensorRotation); - gyroFix.mult(sensorRotation, sensorRotation); - attachmentFix.set(sensorRotation).inverseLocal(); + + fixGyroscope(sensorRotation.clone()); + fixAttachment(sensorRotation.clone()); fixYaw(reference); } @@ -65,39 +72,69 @@ public class ReferenceAdjustedTracker implements Tracker { fixYaw(reference); } + private void fixGyroscope(Quaternion sensorRotation) { + sensorRotation.fromAngles(0, sensorRotation.getYaw(), 0); + gyroFix.set(sensorRotation).inverseLocal(); + } + + private void fixAttachment(Quaternion sensorRotation) { + gyroFix.mult(sensorRotation, sensorRotation); + attachmentFix.set(sensorRotation).inverseLocal(); + } + + @Override + public void resetMounting(boolean reverseYaw) { + tracker.resetMounting(reverseYaw); + + // Get the current calibrated rotation + Quaternion buffer = new Quaternion(); + tracker.getRotation(buffer); + gyroFix.mult(buffer, buffer); + buffer.multLocal(attachmentFix); + + // Reset the vector for the rotation to point straight up + rotVector.set(0f, 1f, 0f); + // Rotate the vector by the quat, then flatten and normalize the vector + buffer.multLocal(rotVector).setY(0f).normalizeLocal(); + + // Calculate the yaw angle using tan + // Just use an angle offset of zero for unsolvable circumstances + float yawAngle = FastMath.isApproxZero(rotVector.x) && FastMath.isApproxZero(rotVector.z) + ? 0f + : FastMath.atan2(rotVector.x, rotVector.z); + + // Make an adjustment quaternion from the angle + buffer.fromAngles(0f, reverseYaw ? yawAngle : yawAngle - FastMath.PI, 0f); + + Quaternion lastRotAdjust = new Quaternion(mountRotFix); + mountRotFix.set(buffer); + + // Get the difference from the last adjustment + buffer.multLocal(lastRotAdjust.inverseLocal()); + // Apply the yaw rotation difference to the yaw fix quaternion + yawFix.multLocal(buffer.inverseLocal()); + } + private void fixYaw(Quaternion reference) { // Use only yaw HMD rotation - Quaternion targetTrackerRotation = new Quaternion(reference); - float[] angles = new float[3]; - targetTrackerRotation.toAngles(angles); - targetTrackerRotation.fromAngles(0, angles[1], 0); + Quaternion targetRotation = new Quaternion(reference); + targetRotation.fromAngles(0, targetRotation.getYaw(), 0); Quaternion sensorRotation = new Quaternion(); tracker.getRotation(sensorRotation); gyroFix.mult(sensorRotation, sensorRotation); sensorRotation.multLocal(attachmentFix); + sensorRotation.multLocal(mountRotFix); - sensorRotation.toAngles(angles); - sensorRotation.fromAngles(0, angles[1], 0); + sensorRotation.fromAngles(0, sensorRotation.getYaw(), 0); - yawFix.set(sensorRotation).inverseLocal().multLocal(targetTrackerRotation); - } - - private void fixGyroscope() { - float[] angles = new float[3]; - - Quaternion sensorRotation = new Quaternion(); - tracker.getRotation(sensorRotation); - - sensorRotation.toAngles(angles); - sensorRotation.fromAngles(0, angles[1], 0); - - gyroFix.set(sensorRotation).inverseLocal(); + yawFix.set(sensorRotation).inverseLocal().multLocal(targetRotation); } protected void adjustInternal(Quaternion store) { gyroFix.mult(store, store); store.multLocal(attachmentFix); + store.multLocal(mountRotFix); yawFix.mult(store, store); } diff --git a/src/main/java/dev/slimevr/vr/trackers/Tracker.java b/src/main/java/dev/slimevr/vr/trackers/Tracker.java index b870f59e4..840a2db0a 100644 --- a/src/main/java/dev/slimevr/vr/trackers/Tracker.java +++ b/src/main/java/dev/slimevr/vr/trackers/Tracker.java @@ -36,6 +36,8 @@ public interface Tracker { void resetYaw(Quaternion reference); + void resetMounting(boolean reverseYaw); + void tick(); TrackerPosition getBodyPosition();