extends Area3D @onready var collision_midpoint: Node3D = $CollisionMidpoint var player var player_on_ladder = false @onready var level_control = get_tree().current_scene # Called when the node enters the scene tree for the first time. func _ready(): pass # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): pass #if player != null: #if player.is_climbing: #hold_player() func _on_body_entered(body): if body.is_in_group("player"): body.is_climbing = true if body.global_position.y < collision_midpoint.global_position.y: body.global_position.y += .2 #else: #body.velocity = Vector3(0,0,0) #body.global_position = Vector3(global_position.x,body.global_position.y,global_position.z) func _on_body_exited(body): if body.is_in_group("player"): body.is_climbing = false player_on_ladder = false body.velocity.y = .1 func hold_player(): var direction_to_ladder = player.global_position.direction_to(self.global_position) player.velocity = Vector3(direction_to_ladder.x * 10,player.velocity.y,direction_to_ladder.z * 10)