GetCameraPosition: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Server client function}} | |||
{{Needs_Checking|Returns 0 0 0 with script: | {{Needs_Checking|Returns 0 0 0 with script: | ||
<syntaxhighlight lang="lua">addCommandHandler ( "getcampos", "retrieveCameraPosition" ) | <syntaxhighlight lang="lua">addCommandHandler ( "getcampos", "retrieveCameraPosition" ) | ||
Line 19: | Line 20: | ||
===Returns=== | ===Returns=== | ||
Returns three [[float|floats]] containing the x, y and z | Returns three [[float|floats]] containing the x, y and z coordinates if the function was successful, ''false'' otherwise. | ||
==Example== | ==Example== | ||
Line 27: | Line 28: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function checkCamera( source ) | function checkCamera( source ) | ||
if ( getCameraMode( source ) == "fixed" ) then --If the camera is fixed... | if ( getCameraMode( source ) == "fixed" ) then -- If the camera is fixed... | ||
local camx, camy, camz = getCameraPosition( source ) --Get the cameras position | local camx, camy, camz = getCameraPosition( source ) -- Get the cameras position | ||
outputConsole( camx .. " " .. camy .. " " .. camz, source ) --And output it. | outputConsole( camx .. " " .. camy .. " " .. camz, source ) -- And output it. | ||
else | else | ||
outputConsole( "The camera is not fixed", source ) --If not, say so. | outputConsole( "The camera is not fixed", source ) -- If not, say so. | ||
end | end | ||
end | end |
Revision as of 16:58, 20 August 2007
This article needs checking. | |
Reason(s): Returns 0 0 0 with script: addCommandHandler ( "getcampos", "retrieveCameraPosition" ) function retrieveCameraPosition ( player, commandName ) local camx, camy, camz = getCameraPosition ( player ) outputChatBox ( "X: "..camx.." Y: "..camy.." Z: "..camz ) end--Ransom 17:17, 11 April 2007 (CDT) |
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
- fadeCamera
- getCameraInterior
- getCameraMatrix
- getCameraTarget
- setCameraInterior
- setCameraMatrix
- setCameraTarget