OnClientRender: Difference between revisions
Jump to navigation
Jump to search
(Added a link to the game processing order page.) |
UniOnDennis (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use [[onClientPreRender]] instead. | This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use [[onClientPreRender]] instead. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function updateCamera () | function updateCamera () | ||
local x, y, z = getElementPosition ( getLocalPlayer () ) | local x, y, z = getElementPosition ( getLocalPlayer () ) |
Revision as of 21:51, 29 June 2013
This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them.
Parameters
None
Source
The source of this event is the client's root element.
Example
This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use onClientPreRender instead.
function updateCamera () local x, y, z = getElementPosition ( getLocalPlayer () ) setCameraMatrix ( x, y, z + 50, x, y, z ) end addEventHandler ( "onClientRender", root, updateCamera )
See Also
Game Processing Order
Other client events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled