Browse Source

Merge pull request #1757 from xyzzy45/patch-1

Add missing if block to VR tutorial source example
Max Hilbrunner 6 years ago
parent
commit
209d1e161c
1 changed files with 9 additions and 8 deletions
  1. 9 8
      tutorials/vr/vr_starter_tutorial.rst

+ 9 - 8
tutorials/vr/vr_starter_tutorial.rst

@@ -377,14 +377,15 @@ Add the following to ``VR_Controller.gd``:
         
         
         # If the menu button is pressed...
-        if grab_mode == "AREA":
-			grab_mode = "RAYCAST"
-			
-			if held_object == null:
-				grab_raycast.visible = true
-		elif grab_mode == "RAYCAST":
-			grab_mode = "AREA"
-			grab_raycast.visible = false
+        if button_index == 1:
+            if grab_mode == "AREA":
+                grab_mode = "RAYCAST"
+                
+                if held_object == null:
+                    grab_raycast.visible = true
+            elif grab_mode == "RAYCAST":
+                grab_mode = "AREA"
+                grab_raycast.visible = false
 
 
     func button_released(button_index):