Browse Source

fix: 3d tutorial squash code (#7204)

Co-authored-by: Max Hilbrunner <[email protected]>
Carson Anderson 2 years ago
parent
commit
c0d9c61e6d
1 changed files with 20 additions and 20 deletions
  1. 20 20
      getting_started/first_3d_game/06.jump_and_squash.rst

+ 20 - 20
getting_started/first_3d_game/06.jump_and_squash.rst

@@ -235,26 +235,26 @@ With this code, if no collisions occurred on a given frame, the loop won't run.
 .. tabs::
  .. code-tab:: gdscript GDScript
 
-   func _physics_process(delta):
-        #...
-
-        # Iterate through all collisions that occurred this frame
-        for index in range(get_slide_collision_count()):
-            # We get one of the collisions with the player
-            var collision = get_slide_collision(index)
-
-            # If the collision is with ground
-            if (collision.get_collider() == null):
-                continue
-
-            # If the collider is with a mob
-            if collision.get_collider().is_in_group("mob"):
-                var mob = collision.get_collider()
-                # we check that we are hitting it from above.
-                if Vector3.UP.dot(collision.get_normal()) > 0.1:
-                    # If so, we squash it and bounce.
-                    mob.squash()
-                    target_velocity.y = bounce_impulse
+    func _physics_process(delta):
+       #...
+
+       # Iterate through all collisions that occurred this frame
+       for index in range(get_slide_collision_count()):
+           # We get one of the collisions with the player
+           var collision = get_slide_collision(index)
+
+           # If the collision is with ground
+           if (collision.get_collider() == null):
+               continue
+
+           # If the collider is with a mob
+           if collision.get_collider().is_in_group("mob"):
+               var mob = collision.get_collider()
+               # we check that we are hitting it from above.
+               if Vector3.UP.dot(collision.get_normal()) > 0.1:
+                   # If so, we squash it and bounce.
+                   mob.squash()
+                   target_velocity.y = bounce_impulse
 
  .. code-tab:: csharp