Skip to content

Commit

Permalink
More correct (but still not completely correct) tracker adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel committed Jul 19, 2021
1 parent a20334d commit 1250e77
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/main/java/io/eiren/vr/trackers/ReferenceAdjustedTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ public void saveConfig(TrackerConfig config) {
*/
@Override
public void resetFull(Quaternion reference) {
resetYaw(reference);

Quaternion sensorRotation = new Quaternion();
tracker.getRotation(sensorRotation);
adjustmentYaw.mult(sensorRotation, sensorRotation);

// Use only yaw HMD rotation
Quaternion targetTrackerRotation = new Quaternion(reference);
float[] angles = new float[3];
targetTrackerRotation.toAngles(angles);
targetTrackerRotation.fromAngles(0, angles[1], 0);
sensorRotation.toAngles(angles);
sensorRotation.fromAngles(angles[0], 0, angles[2]);
adjustmentAttachment.set(sensorRotation).inverseLocal();

adjustmentAttachment.set(sensorRotation).inverseLocal().multLocal(targetTrackerRotation);
resetYaw(reference);
}

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

Quaternion sensorRotation = new Quaternion();
tracker.getRotation(sensorRotation);
sensorRotation.multLocal(adjustmentAttachment);

sensorRotation.toAngles(angles);
sensorRotation.fromAngles(0, angles[1], 0);
Expand Down

0 comments on commit 1250e77

Please sign in to comment.