diff --git a/assets/player.tscn b/assets/player.tscn index 4a373b7..ce573e5 100644 --- a/assets/player.tscn +++ b/assets/player.tscn @@ -388,9 +388,10 @@ target_position = Vector3(0, -1.995, 0) collision_mask = 33 [node name="ClamberCheckRay" type="RayCast3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.607088, -0.488815) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.607088, -0.279418) target_position = Vector3(0, 0, -1) collision_mask = 33 +hit_back_faces = false [connection signal="tree_entered" from="." to="." method="_on_tree_entered"] [connection signal="body_entered" from="pick_up_detection" to="." method="_on_pick_up_detection_body_entered"] diff --git a/scripts/PlayerStates.gd b/scripts/PlayerStates.gd index d98be86..41a33de 100644 --- a/scripts/PlayerStates.gd +++ b/scripts/PlayerStates.gd @@ -14,13 +14,18 @@ func standard_movement(delta): character.velocity.x = lerp(character.velocity.x, character.movement_input().x * move_speed * character.speed_modifiers(),delta * move_transition_speed) character.velocity.z = lerp(character.velocity.z, character.movement_input().z * move_speed * character.speed_modifiers(),delta * move_transition_speed) +func jump_with_weight_mod(): + character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers() + func standard_jump(): - #first check for clamber, otherwise jump - print("CAN CLAMBER? - ",character.can_clamber()) - if character.can_clamber(): - Transitioned.emit(self,"clamber") - else: - character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers() + if Input.is_action_just_pressed("jump"): + #first check for clamber, otherwise jump + if character.can_clamber(): + Transitioned.emit(self,"clamber") + else: + if character.jumps_remaining > 0: + character.jumps_remaining -= 1 + jump_with_weight_mod() func apply_gravity(delta): character.velocity.y -= 9.8 * 1.25 * delta diff --git a/scripts/player.gd b/scripts/player.gd index 869f21e..b95bd9b 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -393,11 +393,15 @@ func speed_modifiers(): func can_clamber(): var clamber_ray_collided = false - const CHECK_RESOLUTION = .1 + const CHECK_RESOLUTION = .01 const MAX_RAY_POSITION = .607 const MIN_RAY_POSITION = -.9 + clamber_check_ray.position.y = MAX_RAY_POSITION + while clamber_check_ray.position.y > MIN_RAY_POSITION: + print("CLAMBER RAY POS : ", clamber_check_ray.position.y) + print("COLLISION : ",clamber_check_ray.is_colliding()) if clamber_check_ray.is_colliding(): clamber_ray_collided = true break diff --git a/scripts/player_crouched.gd b/scripts/player_crouched.gd index 2a0fbb8..c884f2c 100644 --- a/scripts/player_crouched.gd +++ b/scripts/player_crouched.gd @@ -32,7 +32,7 @@ func Physics_Update(delta): if Input.is_action_just_pressed("jump"): if !character.crouch_check.is_colliding(): character.recoil.add_recoil(Vector3(-.2,.03,.03),5,10) - standard_jump() + jump_with_weight_mod() transition_out_of_crouch() diff --git a/scripts/player_jumping.gd b/scripts/player_jumping.gd index dfc9ac4..c211d7a 100644 --- a/scripts/player_jumping.gd +++ b/scripts/player_jumping.gd @@ -13,14 +13,13 @@ func Physics_Update(delta): standard_movement(delta) apply_gravity(delta) + standard_jump() + if character.is_on_floor(): Transitioned.emit(self,"on foot") enable_wall_rays() - if Input.is_action_just_pressed("jump") and (character.jumps_remaining > 0 or character.can_clamber()): - character.jumps_remaining -= 1 - standard_jump() if Input.is_action_just_pressed("sprint") and air_dash_left > 0: air_dash_left -= 1 diff --git a/scripts/player_on_foot.gd b/scripts/player_on_foot.gd index 0b07c16..2ff9e09 100644 --- a/scripts/player_on_foot.gd +++ b/scripts/player_on_foot.gd @@ -14,6 +14,4 @@ func Physics_Update(delta): if Input.is_action_just_pressed("crouch"): Transitioned.emit(self,"crouched") - if Input.is_action_just_pressed("jump"): - character.jumps_remaining -= 1 - standard_jump() + standard_jump()