Look along path while approaching beds
This commit is contained in:
+11
-3
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user