Pointed thing to face pos: Use 'eye height' object property (#6754)
authorParamat <paramat@users.noreply.github.com>
Sat, 9 Dec 2017 13:30:26 +0000 (13:30 +0000)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Sat, 9 Dec 2017 13:30:26 +0000 (14:30 +0100)
builtin/common/misc_helpers.lua

index eccacba4f43543c50ea5d6f4266d93f9387eaa48..01237f265248d3075bf5685c42e7a7fe6dd9ca22 100644 (file)
@@ -670,6 +670,7 @@ end
 -- Returns the exact coordinate of a pointed surface
 --------------------------------------------------------------------------------
 function core.pointed_thing_to_face_pos(placer, pointed_thing)
+       local eye_height = placer:get_properties().eye_height
        local eye_offset_first = placer:get_eye_offset()
        local node_pos = pointed_thing.under
        local camera_pos = placer:get_pos()
@@ -689,7 +690,7 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing)
        end
 
        local fine_pos = {[nc] = node_pos[nc] + offset}
-       camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10
+       camera_pos.y = camera_pos.y + eye_height + eye_offset_first.y / 10
        local f = (node_pos[nc] + offset - camera_pos[nc]) / look_dir[nc]
 
        for i = 1, #oc do