Jump to content

first person


Norhy

Recommended Posts

hey guys

i have this fp script

player = getLocalPlayer() 
  
function findRot(x1, y1, x2, y2) 
    local t = -math.deg(math.atan2(x2 - x1, y2 - y1)) 
    return t < 0 and t + 360 or t 
end 
  
addEventHandler("onClientRender", getRootElement(), 
    function() 
        local x, y, z = getPedBonePosition(player, 6) 
        setCameraMatrix(x, y, z) 
    end 
) 
  
addEventHandler("onClientCursorMove", getRootElement(), 
    function(_, _, _, _, wX, wY, wZ) 
        local x, y, z = getPedBonePosition(player, 6) 
        setPedRotation(player, findRot(x, y, wX, wY)) 
    end 
) 

the problem is, when i move the mouse my rotation is reset . how do i fix it?

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...