Re: Re: Untitled

From Bitty Lemur, 10 Years ago, written in Lua, viewed 944 times. This paste will cross the great divide in 1 Second. This paste is a reply to Re: Untitled from Commodious Peccary - go back
URL https://paste.godclan.hu/view/J9IOkIfT/diff Embed
Viewing differences between Re: Untitled and Re: Re: Untitled
function baseRotate(x, y, rz)
    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)
    y, z = baseRotate(y, z, rx)
    x, z = baseRotate(-x, z, ry)
    x = -x
    x, y = baseRotate(x, y, rz)
    return x, y, z
end

function setTurnVelocityAlong(vehElement, x, y, z, v)
    -- Normalize vector
    local r = sqrt(x * x + y * y + z * z)
    local x2 = x / r
    local y2 = y / r
    local 
x2, y2, z2 = x * v / r, y * v / r, * v / r

    -- Rotate vector
    local rx, ry, rz = getElementRotation(vehElement, "ZYX")
    x, y, z = rotate(x2, y2, z2, rx, ry, rz)

    -- Set turn velocity
    x, y, z = x * v, y * v, z * v\n    return setVehicleTurnVelocity(vehElement, x, y, z)
end

Replies to Re: Re: Untitled rss

Title Name Language When
Re: Re: Re: Untitled Scanty Dolphin lua 10 Years ago.
Re: Re: Re: Untitled Corrupt Flamingo lua 10 Years ago.

Reply to "Re: Re: Untitled"

Here you can reply to the paste above