Look along path while approaching beds

This commit is contained in:
Tanner
2026-11-07 23:21:41 +00:00
parent 9cbadbd551
commit 11add13779
4 changed files with 64 additions and 6 deletions
+11 -3
View File
@@ -67,6 +67,16 @@ def look_direction_from_eye(position, target):
return eye - target
def navigation_look_target(path_points):
if len(path_points) > YAW_LOOK_AHEAD:
point = path_points[YAW_LOOK_AHEAD]
elif path_points:
point = path_points[-1]
else:
return None
return vector.Point3D((point[0], point[1] + 1, point[2]))
def update_pitch(g, look_at_d):
if look_at_d is None:
target_pitch = 0.0
@@ -247,10 +257,8 @@ def tick(global_state):
if g.look_at:
look_at = vector.Point3D(g.look_at)
elif g.path and len(g.path) > YAW_LOOK_AHEAD:
look_at = vector.Point3D(g.path[YAW_LOOK_AHEAD])
elif g.path and len(g.path):
look_at = vector.Point3D(g.path[-1])
look_at = navigation_look_target(g.path)
else:
look_at = None