Changed heading calculation.

This commit is contained in:
Harrison Deng 2021-05-03 15:28:43 -05:00
parent 0396caf149
commit 22acaca89f

View File

@ -251,29 +251,27 @@ local function determineHeading()
sendLog(FAILED, "Could not move to get delta.")
return
end
if x == nil then
if position == nil then
sendLog(FAILED, "Could not locate.")
return
end
heading = position - oldPos
local fDelta = position - oldPos
if not attemptMoveRight() then
sendLog(FAILED, "Unable to rotate right.")
heading = nil
return
end
local oldPos = vector.new(position.x, position.y, position.z)
if not attemptMoveForward() then
sendLog(FAILED, "Unable to move forward after rotation.")
heading = nil
return
end
if not attemptMoveLeft() then
sendLog(FAILED, "Unable to rotate left.")
heading = nil
return
end
heading = fDelta
rightAxis = position - oldPos
end