New paste Repaste Download
extends CharacterBody3D
@export var config: PlayerConfig
@onready var movement = $PlayerMovement
@onready var jump = $PlayerJump
@onready var gravity = $PlayerGravity
@onready var player_input = $InputController
@onready var camera = $Camera3D
func _ready():
    Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _physics_process(delta: float) -> void:
    # Update vertical velocity with appropriate gravity
    velocity.y += gravity.get_gravity(is_on_floor()) * delta
    # Coyote time
    jump.update_coyote_timer(is_on_floor(), delta)
    # Handle jumping
    if jump.can_jump(is_on_floor()) and player_input.is_jump_pressed():
        velocity.y = jump.perform_jump()
    # Handle horizontal movement
    var input = player_input.get_movement_input()
    velocity = movement.calculate_movement(velocity, input, transform, is_on_floor())
    # Apply movement
    move_and_slide()
func _input(event: InputEvent) -> void:
    player_input.process_mouse_input(event, camera)
Filename: None. Size: 1kb. View raw, , hex, or download this file.

This paste expires on 2024-12-26 20:24:37.749417. Pasted through web.