fixed focus distance

This commit is contained in:
derek
2024-08-07 11:00:58 -05:00
parent 5cffedfa4f
commit 795e1ae7f6
2 changed files with 5 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ fov = 13.6855
target_position = Vector3(0, 0, -1) target_position = Vector3(0, 0, -1)
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
wait_time = 0.5 wait_time = 0.4
one_shot = true one_shot = true
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View File

@@ -29,10 +29,10 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var focus_dist = abs(camera.global_position - target.global_position) var focus_dist = camera.global_position.distance_to(target.global_position)
print("focus dist " + str(focus_dist))
camera.attributes.dof_blur_far_distance = focus_dist.z + 3 camera.attributes.dof_blur_far_distance = focus_dist + 2
camera.attributes.dof_blur_near_distance = focus_dist.z - 1 camera.attributes.dof_blur_near_distance = focus_dist - 2
# Move towards and look at target # Move towards and look at target
if target != null and respawn == false: if target != null and respawn == false: