fix: Adds look vector correction code
This is needed for the Xreal line of devices as the reverse engineered driver works, but has... issues. One of them being normal sensor drift, the other being ~2330 units in any direction for some reason. This is a hack but I can't think of a normal person that can spin their head around fast enough to trigger anything past 7 units/pull cycle, especially considering our already high pulling rate (basically as fast as we can)
This commit is contained in:
parent
0efaf19b40
commit
102c83d5b9
1 changed files with 18 additions and 0 deletions
|
@ -235,6 +235,24 @@ func EnterRenderLoop(config *libconfig.Config, displayMetadata *edidtools.Displa
|
||||||
lookVector.Z = (currentRoll - previousRoll) * 6.5
|
lookVector.Z = (currentRoll - previousRoll) * 6.5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// evil look hacks to not randomly explode
|
||||||
|
maxTrustedSize := float64(7)
|
||||||
|
|
||||||
|
if math.Abs(float64(lookVector.X)) > maxTrustedSize {
|
||||||
|
log.Errorf("WOAH. Ignoring extreme camera movement for vector X: %.02f", lookVector.X)
|
||||||
|
lookVector.X = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if math.Abs(float64(lookVector.Y)) > maxTrustedSize {
|
||||||
|
log.Errorf("WOAH. Ignoring extreme camera movement for vector Y: %.02f", lookVector.Y)
|
||||||
|
lookVector.Y = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasZVectorDisabledQuirk && math.Abs(float64(lookVector.Z)) > maxTrustedSize {
|
||||||
|
log.Errorf("WOAH. Ignoring extreme camera movement for vector Z: %.02f", lookVector.Z)
|
||||||
|
lookVector.Z = 0
|
||||||
|
}
|
||||||
|
|
||||||
rl.UpdateCameraPro(&camera, movementVector, lookVector, 0)
|
rl.UpdateCameraPro(&camera, movementVector, lookVector, 0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue