GetCameraPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
{{Needs_Checking|This function is now clientside only.}}
__NOTOC__  
__NOTOC__  
This function returns the position the player's camera would have if the camera mode is fixed (see [[setCameraMode]]).
This function returns the position the player's camera would have if the camera mode is fixed (see [[setCameraMode]]).

Revision as of 16:08, 29 November 2007

This function returns the position the player's camera would have if the camera mode is fixed (see setCameraMode).

Syntax

float float float getCameraPosition ( player thePlayer )

Required Arguments

  • thePlayer: The player whose camera position you wish to obtain.

Returns

Returns three floats containing the x, y and z coordinates if the function was successful, false otherwise.

Example

This example checks if the camera is fixed, and prints its position if so.

function checkCamera( source )
      if ( getCameraMode( source ) == "fixed" ) then                    -- If the camera is fixed...
            local camx, camy, camz = getCameraPosition( source )        -- Get the cameras position
            outputConsole( camx .. " " .. camy .. " " .. camz, source ) -- And output it.
      else
            outputConsole( "The camera is not fixed", source )          -- If not, say so.
      end
end
addCommandHandler( "check", checkCamera )

See Also