SetCameraLookAt: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The player whose camera you wish to modify. | *'''thePlayer:''' The player whose camera you wish to modify. | ||
*'''x:''' The x | *'''x:''' The x coordinate of the point to be looked at. | ||
*'''y:''' The y | *'''y:''' The y coordinate of the point to be looked at. | ||
*'''z:''' The z | *'''z:''' The z coordinate of the point to be looked at. | ||
===Returns=== | ===Returns=== | ||
Returns | Returns ''true'' if the function was successful, ''false'' otherwise. | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function spawnScreen ( source ) | function spawnScreen ( source ) | ||
setCameraMode ( source, "fixed" ) -- | setCameraMode ( source, "fixed" ) -- Make the camera fixed (instead of following the player) | ||
setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- | setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- Set the coordinates of the camera | ||
setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 ) -- | setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 ) -- Make the camera look at specified coordinates | ||
bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos ) -- | bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos ) -- Bind spawn key (function spawnVagos is not given here) | ||
bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs ) -- | bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs ) -- Bind spawn key (function spawnAztecs is not given here) | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 13:04, 16 August 2007
This function allows you to set a player's camera to look at a specific point when the camera is fixed (see setCameraMode).
Syntax
bool setCameraLookAt ( player thePlayer, float x, float y, float z )
Required Arguments
- thePlayer: The player whose camera you wish to modify.
- x: The x coordinate of the point to be looked at.
- y: The y coordinate of the point to be looked at.
- z: The z coordinate of the point to be looked at.
Returns
Returns true if the function was successful, false otherwise.
Example
function spawnScreen ( source ) setCameraMode ( source, "fixed" ) -- Make the camera fixed (instead of following the player) setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- Set the coordinates of the camera setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 ) -- Make the camera look at specified coordinates bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos ) -- Bind spawn key (function spawnVagos is not given here) bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs ) -- Bind spawn key (function spawnAztecs is not given here) end
See Also
- fadeCamera
- getCameraInterior
- getCameraMatrix
- getCameraTarget
- setCameraInterior
- setCameraMatrix
- setCameraTarget