Jump to content

one question


Recommended Posts

Thanks helped me alot

but I have a problem is possible when the mouse is rotate also rotate the camera ?

    function camera () 
        local theVehicle = getPedOccupiedVehicle(localPlayer) 
        if (not theVehicle or isPedDead(localPlayer)) then return end 
  
        local eM = getElementMatrix( theVehicle ) 
        local vx, vy, vz = getElementVelocity( theVehicle ) 
        local speed = math.sqrt(math.pow(vx, 2) + math.pow(vy, 2) + math.pow(vz, 2)) + 0.5 
        local distance = 5 * speed + 10 
        local heightAboveVehicle = 5 
        local roll = math.deg(math.atan2(eM[1][3], eM[3][3])) 
        local x = -distance * eM[2][1] + eM[4][1] 
        local y = -distance * eM[2][2] + eM[4][2] 
        local z = -distance * eM[2][3] + heightAboveVehicle * eM[3][3] + eM[4][3] 
        local lx = 4 * eM[2][1] + eM[4][1] 
        local ly = 4 * eM[2][2] + eM[4][2] 
        local lz = 4 * eM[2][3] + eM[4][3] 
        if getCameraViewMode (  ) == 2 then 
            setCameraMatrix( x, y, z, lx, ly, lz, roll) 
        end 
    end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...