- Documentation
- Client events
- onClientPedsProcessed
Event
onClientPedsProcessed
Every frame, right after all peds' animations and bones are updated and before onClientPreRender. Here getPedBonePosition and getPedBoneMatrix return this frame's positions, so manually attached objects and effects do not lag a frame behind.
Handler
addEventHandler("onClientPedsProcessed", root, function() ... end)Source
source is root.
Example
addEventHandler("onClientPedsProcessed", root, function()
local x, y, z = getPedBonePosition(localPlayer, 8)
if x then setElementPosition(halo, x, y, z + 0.3) end
end)
See also
getPedBoneMatrixReturns a ped bone's 4x4 matrix for this frame, in the same layout asgetElementMatrix: row 1 = the bone's X axis, 2 = Y axis, 3 = Z axis, 4 = position. These are the same axes in whichattachElementToBoneapplies its offset and rotation, so the attach point isposition + X*dx + Y*dy + Z*dz. It is computed straight from the bone rotation in the engine, without Euler angles, so it keeps its precision at 90° turns.onClientPreRenderArrives every frame beforeonClientRender, without drawing. It gets the time since the previous frame, so it suits smooth movement (cameras, animations).