enemy now can walk on slopes

This commit is contained in:
Rendo 2025-07-27 21:11:10 +05:00
commit eec69524ee
4 changed files with 35 additions and 20 deletions

View file

@ -9,7 +9,7 @@ func _process(delta: float) -> void:
if Engine.is_editor_hint():
camera = EditorInterface.get_editor_viewport_3d().get_camera_3d()
# Angle between camera's -basis.z (forward direction) and direction to camera
var angle = vec3_to_vec2(-global_transform.basis.z).angle_to(vec3_to_vec2(global_position - camera.global_position)) + PI
var angle = vec3_to_vec2(global_transform.basis.z).angle_to(vec3_to_vec2(global_position - camera.global_position)) + PI
var chosen_index = 0
for i in rotations.keys():
if abs(angle-i) < abs(angle-chosen_index):