From bfe71ec37c98e5ce69d8311b754fecfe6b9c9aa8 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Sat, 4 Sep 2021 15:50:31 +0200 Subject: [PATCH] reactivate gravity --- scenes/game/alpha.tscn | 1 + scenes/player/playerB.gd | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scenes/game/alpha.tscn b/scenes/game/alpha.tscn index 4e2502f..3149001 100644 --- a/scenes/game/alpha.tscn +++ b/scenes/game/alpha.tscn @@ -11,6 +11,7 @@ [node name="spatial" type="Spatial"] [node name="player" parent="." instance=ExtResource( 8 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0 ) [node name="area_0_0" parent="." instance=ExtResource( 2 )] diff --git a/scenes/player/playerB.gd b/scenes/player/playerB.gd index a0357ec..66d1a4d 100644 --- a/scenes/player/playerB.gd +++ b/scenes/player/playerB.gd @@ -107,15 +107,12 @@ func _process( delta ): # Movement velocity = self.calculate_velocity(velocity, move_direction, delta) - Config.msg_info("move_direction X:" + str(move_direction.x) + " Y:" + str(move_direction.y) + " Z:" + str(move_direction.z)) - Config.msg_info("velocity X:" + str(velocity.x) + " Y:" + str(velocity.y) + " Z:" + str(velocity.z)) + # Config.msg_info("move_direction X:" + str(move_direction.x) + " Y:" + str(move_direction.y) + " Z:" + str(move_direction.z)) + # Config.msg_info("velocity X:" + str(velocity.x) + " Y:" + str(velocity.y) + " Z:" + str(velocity.z)) velocity = $creature.move_and_slide(velocity, Vector3.UP, true) - # velocity = self.calculate_velocity(velocity, input_direction, delta) - #velocity = $creature.move_and_slide(velocity, Vector3.UP, true) - #Config.msg_info("X:" + str($creature.)) var pos : Vector3 = $creature.get_global_transform().origin Config.msg_info("pos X:" + str(pos.x) + " Y:" + str(pos.y) + " Z:" + str(pos.z)) - + func calculate_velocity( @@ -129,7 +126,7 @@ func calculate_velocity( velocity_new *= $creature.move_speed if velocity_new.length() > $creature.max_speed: velocity_new = velocity_new.normalized() * $creature.max_speed - #velocity_new.y = velocity_current.y + gravity * delta + velocity_new.y = velocity_current.y + gravity * delta return velocity_new