'grow' chaperone bounds up when moving playspace

This commit is contained in:
Robin Appelman
2018-03-27 00:08:09 +02:00
parent 1a260fbceb
commit 9522e45466
+7 -2
View File
@@ -559,7 +559,6 @@ void OverlayController::AddOffsetToCollisionBounds(float offset[3], bool commit)
// Apparently Valve sanity-checks the y-coordinates of the collision bounds (and only the y-coordinates)
// I can move the bounds on the xz-plane, I can make the "ceiling" of the chaperone cage lower/higher, but when I
// dare to set one single lower corner to something non-zero, every corner gets its y-coordinates reset to the defaults.
// I do it anyway, maybe it gets fixed in the future.
if (commit) {
vr::VRChaperoneSetup()->RevertWorkingCopy();
}
@@ -571,7 +570,13 @@ void OverlayController::AddOffsetToCollisionBounds(float offset[3], bool commit)
for (unsigned b = 0; b < collisionBoundsCount; b++) {
for (unsigned c = 0; c < 4; c++) {
collisionBounds[b].vCorners[c].v[0] += offset[0];
collisionBounds[b].vCorners[c].v[1] += offset[1];
// keep the lower corners on the ground so it doesn't reset all y cooridinates.
// this causes the caperone to "grow" up instead of not moving up at all.
// note that Valve still forces a minimum height so we can't go into the ground
if (collisionBounds[b].vCorners[c].v[1] != 0) {
collisionBounds[b].vCorners[c].v[1] += offset[1];
}
collisionBounds[b].vCorners[c].v[2] += offset[2];
}
}