extends PlayerState class_name PlayerClamber var clamber_point const CLAMBER_Y_OFFSET = .4 func Enter(): clamber_point = character.get_clamber_point() character.velocity = Vector3.ZERO func Physics_Update(delta): character.global_position.y = lerp(character.global_position.y,clamber_point.y - CLAMBER_Y_OFFSET,delta * 2) if !is_still_on_ledge(): Transitioned.emit(self,"in air") if Input.is_action_just_pressed("jump"): jump_with_weight_mod() Transitioned.emit(self,"in air") if Input.is_action_just_pressed("crouch"): Transitioned.emit(self,"in air") ledge_movement(delta) func is_still_on_ledge(): if character.clamber_point_ray.is_colliding(): return true else: return false func ledge_movement(delta): var direction = character.movement_input() character.velocity.x = lerp(character.velocity.x,direction.x * move_speed,delta * move_transition_speed) #if direction.x < 0: #if character.ledge_l_ray.is_colliding(): #character.velocity.x += direction.x * delta * move_speed #if direction.x > 0: #if character.ledge_r_ray.is_colliding(): #character.velocity.x += direction.x * delta * move_speed