Skip to content

Commit 1250e77

Browse files
committed
More correct (but still not completely correct) tracker adjustments
1 parent a20334d commit 1250e77

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

‎src/main/java/io/eiren/vr/trackers/ReferenceAdjustedTracker.java‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,14 @@ public void saveConfig(TrackerConfig config) {
4444
*/
4545
@Override
4646
public void resetFull(Quaternion reference) {
47-
resetYaw(reference);
48-
4947
Quaternion sensorRotation = new Quaternion();
5048
tracker.getRotation(sensorRotation);
51-
adjustmentYaw.mult(sensorRotation, sensorRotation);
52-
53-
// Use only yaw HMD rotation
54-
Quaternion targetTrackerRotation = new Quaternion(reference);
5549
float[] angles = new float[3];
56-
targetTrackerRotation.toAngles(angles);
57-
targetTrackerRotation.fromAngles(0, angles[1], 0);
50+
sensorRotation.toAngles(angles);
51+
sensorRotation.fromAngles(angles[0], 0, angles[2]);
52+
adjustmentAttachment.set(sensorRotation).inverseLocal();
5853

59-
adjustmentAttachment.set(sensorRotation).inverseLocal().multLocal(targetTrackerRotation);
54+
resetYaw(reference);
6055
}
6156

6257
/**
@@ -76,6 +71,7 @@ public void resetYaw(Quaternion reference) {
7671

7772
Quaternion sensorRotation = new Quaternion();
7873
tracker.getRotation(sensorRotation);
74+
sensorRotation.multLocal(adjustmentAttachment);
7975

8076
sensorRotation.toAngles(angles);
8177
sensorRotation.fromAngles(0, angles[1], 0);

0 commit comments

Comments
 (0)