Jump to content

Camera Matrix


isa_Khamdan

Recommended Posts

Posted

Why this code doesn't work?

addCommandHandler( "get", 
  function ( thePlayer ) 
  local x, y, z, x1, y1, z1 = getCameraMatrix ( thePlayer ) 
  
        outputChatBox(  x , y , z , x1 , y1 , z1 , thePlayer) 
  
    end 
) 

Posted
addCommandHandler( "get", 
        function ( thePlayer ) 
                local x, y, z, x1, y1, z1 = getCameraMatrix ( thePlayer ) 
                outputChatBox(  x..","..y..","..z..","..x1..","..y1..","..z1 , thePlayer) 
        end 
) 

Posted
addCommandHandler( "get", 
        function ( thePlayer ) 
                local x, y, z, x1, y1, z1 = getCameraMatrix ( thePlayer ) 
                outputChatBox(  x..","..y..","..z..","..x1..","..y1..","..z1 , thePlayer) 
        end 
) 

Dosen't work :/

[19:04:11] ERROR: get\get.lua:8: attempt to concatenate local 'z1' (a nil value)

Posted
addCommandHandler ( "get", 
    function ( thePlayer ) 
        outputChatBox ( table.concat ( { getCameraMatrix ( thePlayer ) }, ", " ), thePlayer ) 
    end 
) 

Posted

put this codes in client side

clientside:

addCommandHandler( "get", 
        function ( thePlayer ) 
                local x, y, z, x1, y1, z1 = getCameraMatrix ( thePlayer ) 
                outputChatBox(  x..","..y..","..z..","..x1..","..y1..","..z1 , thePlayer) 
        end 
) 

Posted

There's no need for 'thePlayer' in the client side, as getCameraMatrix has no arguments when used client side, nor command handler has a player element on the client side.

Posted

0 = N

90 = E

180 = S

270 = W

function findRotation(x1,y1,x2,y2) 
  local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
  if t < 0 then t = t + 360 end; 
  return t; 
end 
  
addCommandHandler( "get", 
  function ( thePlayer ) 
    local x, y, z, x1, y1, z1 = getCameraMatrix ( thePlayer ) 
    local rx, ry, rz = findRotation(x, y, x1, y1) 
    outputChatBox(  rz, thePlayer) 
  end 
) 

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