setPedLookAt | Multi Theft Auto: Wiki Skip to content

setPedLookAt

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Makes a ped turn his head and look at a specific world position or element.

Note

Avoid calling setPedLookAt every frame as this can cause bugs like being invincible to burning.

Important

For remote players, you have to use setPedAimTarget before setPedLookAt.

Syntax

setPedLookAt ( )

Code Examples

client

This example makes the local player look at where the camera points at. If you want to sync this effect with other players you can usetriggerLatentServerEventandtriggerLatentClientEventfunctions.

local screenSize_X, screenSize_Y = guiGetScreenSize()
function pedLookAt()
local x, y, z = getWorldFromScreenPosition(screenSize_X / 2, screenSize_Y / 2, 15)
setPedLookAt(localPlayer, x, y, z, -1, 0)
end
setTimer(pedLookAt, 120, 0)

Issues

ID Description
509 setPedLookAt does not work for remote players
626 setPedLookAt cancels damage done by any sort of fire

See Also