From f0be55c39ed59072c2bc5e124787e3812b83ee9a Mon Sep 17 00:00:00 2001 From: DocQuantum Date: Wed, 3 Feb 2021 17:49:36 -0600 Subject: [PATCH 1/2] Teleport.cs: Check for existence of controllers before accessing them When trying to work on a project without an HMD with controllers, the project defaults to 2D Debug mode. However, since the code expects the controllers to exist, it's not able to get past trying to execute haptic feedback which results in teleporting to fail in 2D Debug mode. These changes make sure that the script check for controller existence before trying to access them. This fixes issue #483 --- .../InteractionSystem/Teleport/Scripts/Teleport.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs b/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs index 71352766..4dbad2ea 100644 --- a/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs +++ b/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs @@ -797,7 +797,7 @@ private void PlayAudioClip( AudioSource source, AudioClip clip ) //------------------------------------------------- private void PlayPointerHaptic( bool validLocation ) { - if ( pointerHand != null ) + if ( pointerHand != null && pointerHand.noSteamVRFallbackCamera == null ) { if ( validLocation ) { @@ -895,11 +895,11 @@ private void TeleportPlayer() { Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess; player.trackingOriginTransform.position = teleportPosition + playerFeetOffset; - - if (player.leftHand.currentAttachedObjectInfo.HasValue) - player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value); - if (player.rightHand.currentAttachedObjectInfo.HasValue) - player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value); + + if (player.leftHand != null && player.leftHand.currentAttachedObjectInfo.HasValue) + player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value); + if (player.rightHand != null && player.rightHand.currentAttachedObjectInfo.HasValue) + player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value); } else { From d479c8fa07dc9514c6b1e3aee1322242c1e19e03 Mon Sep 17 00:00:00 2001 From: DocQuantum Date: Wed, 3 Feb 2021 18:03:12 -0600 Subject: [PATCH 2/2] Teleport.cs: Fix whitespace discrepency --- Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs b/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs index 4dbad2ea..ef33f823 100644 --- a/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs +++ b/Assets/SteamVR/InteractionSystem/Teleport/Scripts/Teleport.cs @@ -900,7 +900,7 @@ private void TeleportPlayer() player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value); if (player.rightHand != null && player.rightHand.currentAttachedObjectInfo.HasValue) player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value); - } + } else { teleportingToMarker.TeleportPlayer( pointedAtPosition );