when i was just making a simple mobile game this decided to not work for some reason
extends CharacterBody3D
const SPEED = 4.0
const JUMP_VELOCITY = 4.5
@onready var nav = $NavigationAgent3D
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
nav.target_position = global.player.global_transform.origin
var current = global_transform.origin
var nextpos = nav.get_next_path_position()
var direction = (nextpos - current).normalized()
velocity = direction * SPEED
move_and_slide()
i pasted some code from another project and it doesn’t work here but is the opposite in the other