function lookAtTarget(targetX, targetY, targetZ)
local botX, botY, botZ = getBotPosition()
local dirX = targetX - botX
local dirY = targetY - botY
local dirZ = targetZ - botZ
local yaw = -math.atan2(dirY, dirX) + 1.5
local horizontalDist = math.sqrt(dirX * dirX + dirY * dirY)
local pitch = -math.atan2(dirZ, horizontalDist)
local cy = math.cos(yaw * 0.5)
local sp = math.sin(pitch * 0.5)
local w = math.cos(yaw/2)
local x = sp * cy
local y = 0.15
if math.sin(yaw/2) < 0.1 then
y = 0
elseif math.sin(yaw/2) < 0 then
y = -y
end
local z = math.sin(yaw/2)
setBotQuaternion(w, x, y, z)
end