yoya99 Posted October 31, 2014 Share Posted October 31, 2014 hello that is my matrix resource but there is a problem ...if i exit the plane the matrix is not set to the local player again ( pls help addEventHandler("onClientPreRender", root, function() local theVehicle = getPedOccupiedVehicle(localPlayer) if (not theVehicle) 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 + 12 local heightAboveVehicle = 2.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 ( getVehicleType( theVehicle ) == "Plane" ) then setCameraMatrix( x, y, z, lx, ly, lz, roll) end end ) Link to comment
Woovie Posted October 31, 2014 Share Posted October 31, 2014 addEventHandler("onClientPlayerVehicleExit", localPlayer, function() setCameraTarget(localPlayer) end) addEventHandler("onClientResourceStop", localPlayer, function() setCameraTarget(localPlayer) end) Link to comment
yoya99 Posted October 31, 2014 Author Share Posted October 31, 2014 thank you very much... Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now