local x2 = x * cos(rz) - y * sin(rz)
local y2 = x * sin(rz) + y * cos(rz)
return x2, y2
end
-- ZYX rotation
function rotate(x, y, z, rx, ry, rz)
x, y = baseRotate(x, y,
x, z = baseRotate(-x, z, ry)
x = -x
return x, y, z
end
local thisVeh
local x1, y1, z1, x2, y2, z2 = 0, 0, 0, 0, 0, 0
function setTurnVelocityAlong(vehElement, x, y, z, v)
-- Normalize vector
local r = sqrt(x * x + y * y + z * z)
-- Rotate vector
local rx, ry, rz = getElementRotation(vehElement, "ZYX")
-- For debug
x1, y1, z1 = getElementPosition(vehElement)
addEventHandler("onClientRender", getRootElement(), createLine)
-- Set turn velocity
-- return setVehicleTurnVelocity(vehElement,
end
function createLine ( )
dxDrawLine3D(x1, y1, z1, x1 + x2, y1 + y2, z1 + z2, tocolor(0, 255, 0, 230), 2)
end