Fixed quest system path indicator

This commit is contained in:
Segey Lapin
2020-04-15 14:54:49 +03:00
parent 32c5212209
commit 4e3135559f
6 changed files with 57 additions and 15 deletions

View File

@@ -17,11 +17,19 @@ func _ready():
func _process(delta):
var pos = get_viewport().get_camera().unproject_position(target)
rect = get_viewport_rect()
if rect.has_point(pos):
if !visible:
show()
rect.grow(-8.0)
if get_viewport().get_camera().is_position_behind(target):
if visible:
hide()
else:
pos.x = clamp(pos.x, rect.position.x, rect.position.x + rect.size.x)
pos.y = clamp(pos.x, rect.position.x, rect.position.x + rect.size.x)
position = position.linear_interpolate(pos, delta)
if rect.has_point(pos):
if !visible:
show()
else:
pos.x = clamp(pos.x, rect.position.x, rect.position.x + rect.size.x)
pos.y = clamp(pos.y, rect.position.y, rect.position.y + rect.size.y)
if position.distance_squared_to(pos) < 480.0:
position = position.linear_interpolate(pos, delta)
else:
position = pos