diff --git a/Assets/SteamVR_Unity_Toolkit/Examples/Resources/Prefabs/Ball.prefab b/Assets/SteamVR_Unity_Toolkit/Examples/Resources/Prefabs/Ball.prefab index 9b946a53a..a23622f48 100644 Binary files a/Assets/SteamVR_Unity_Toolkit/Examples/Resources/Prefabs/Ball.prefab and b/Assets/SteamVR_Unity_Toolkit/Examples/Resources/Prefabs/Ball.prefab differ diff --git a/Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_PlayerPresence.cs b/Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_PlayerPresence.cs index e03683867..627023172 100644 --- a/Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_PlayerPresence.cs +++ b/Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_PlayerPresence.cs @@ -7,6 +7,7 @@ public class VRTK_PlayerPresence : MonoBehaviour { public float headsetYOffset = 0.2f; public bool ignoreGrabbedCollisions = true; + public bool resetPositionOnCollision = true; private Transform headset; private Rigidbody rb; @@ -58,7 +59,7 @@ private void OnUngrabObject(object sender, ObjectInteractEventArgs e) private void OnHeadsetCollision(object sender, HeadsetCollisionEventArgs e) { - if (lastGoodPositionSet) + if (resetPositionOnCollision && lastGoodPositionSet) { SteamVR_Fade.Start(Color.black, 0f); this.transform.position = lastGoodPosition; diff --git a/README.md b/README.md index 52b330f96..9aa133ddd 100644 --- a/README.md +++ b/README.md @@ -579,6 +579,13 @@ The following script parameters are available: box collider and rigid body on the play area. This is very useful if the user is required to grab and wield objects because if the collider was active they would bounce off the play area collider. + * **Reset Position On Collision:** If this is checked then if the + Headset Collision Fade script is present and a headset collision + occurs, the Camera Rig is moved back to the last good known + standing position. This deals with any collision issues if a user + stands up whilst moving through a crouched area as instead of them + being able to clip into objects they are transported back to a + position where they are able to stand. An example of the `VRTK_PlayerPresence` script can be viewed in the scene `SteamVR_Unity_Toolkit/Examples/017_CameraRig_TouchpadWalking`.