Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends CharacterBody3D
- var speed = 15
- var accel = 2
- @onready var nav = $NavigationAgent3D
- func _physics_process(delta):
- var direction = Vector3()
- nav.target_position = G.player.global_position
- await(get_tree().process_frame)
- direction = nav.get_next_path_position() - global_position
- direction = direction.normalized()
- velocity = velocity.lerp(direction * speed, accel * delta)
- move_and_slide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement