Jump to content

First person aiming problem


Recommended Posts

Hello. I am trying to create first person aiming with setCameraMatrix. After some brain work I decided to use getPedTargetStart as coordinates of camera's position and getPedTargetEnd as coordinates of look-at position.

addEventHandler('onClientRender', root, function() 
    if getControlState ( "aim_weapon" ) then 
        local x,y,z = getPedTargetStart ( localPlayer ) 
        local xx,yy,zz = getPedTargetEnd ( localPlayer ) 
        setCameraMatrix (x,y,z,xx,yy,zz) 
        was_aiming = true 
    elseif was_aiming then 
        was_aiming = false 
        setCameraTarget ( localPlayer ) 

But then in aim mode player's camera continuously moving up and right:

How to make player's camera stand still and move only when player moves the mouse?

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