From 9522e45466efa052370dbb240306f458b165c0bb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 27 Mar 2018 00:08:09 +0200 Subject: [PATCH] 'grow' chaperone bounds up when moving playspace --- src/overlaycontroller.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index b7a70f3..134434b 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -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]; } }