Skip to content

Commit 6823400

Browse files
authored
Merge pull request godotengine#8332 from CrisHigham/bugfix/3d-for-loop-tabs
Update 06.jump_and_squash.rst
2 parents b9bb256 + 426c83b commit 6823400

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

getting_started/first_3d_game/06.jump_and_squash.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -236,25 +236,25 @@ With this code, if no collisions occurred on a given frame, the loop won't run.
236236
.. code-tab:: gdscript GDScript
237237

238238
func _physics_process(delta):
239-
#...
240-
241-
# Iterate through all collisions that occurred this frame
242-
for index in range(get_slide_collision_count()):
243-
# We get one of the collisions with the player
244-
var collision = get_slide_collision(index)
245-
246-
# If the collision is with ground
247-
if collision.get_collider() == null:
248-
continue
249-
250-
# If the collider is with a mob
251-
if collision.get_collider().is_in_group("mob"):
252-
var mob = collision.get_collider()
253-
# we check that we are hitting it from above.
254-
if Vector3.UP.dot(collision.get_normal()) > 0.1:
255-
# If so, we squash it and bounce.
256-
mob.squash()
257-
target_velocity.y = bounce_impulse
239+
#...
240+
241+
# Iterate through all collisions that occurred this frame
242+
for index in range(get_slide_collision_count()):
243+
# We get one of the collisions with the player
244+
var collision = get_slide_collision(index)
245+
246+
# If the collision is with ground
247+
if collision.get_collider() == null:
248+
continue
249+
250+
# If the collider is with a mob
251+
if collision.get_collider().is_in_group("mob"):
252+
var mob = collision.get_collider()
253+
# we check that we are hitting it from above.
254+
if Vector3.UP.dot(collision.get_normal()) > 0.1:
255+
# If so, we squash it and bounce.
256+
mob.squash()
257+
target_velocity.y = bounce_impulse
258258

259259
.. code-tab:: csharp
260260

0 commit comments

Comments
 (0)