<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vr.introv3nous</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vr.introv3nous"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Vr.introv3nous"/>
	<updated>2026-04-22T22:51:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetPedLookAt&amp;diff=63095</id>
		<title>SetPedLookAt</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetPedLookAt&amp;diff=63095"/>
		<updated>2019-06-26T01:16:18Z</updated>

		<summary type="html">&lt;p&gt;Vr.introv3nous: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Note|Avoid calling setPedLookAt every frame as this can cause bugs like being invincible to burning.}}&lt;br /&gt;
{{Note|For remote players, you have to use [https://wiki.multitheftauto.com/wiki/SetPedAimTarget setPedAimTarget] before setPedLookAt.}}&lt;br /&gt;
Makes a ped turn his head and look at a specific world position or element.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPedLookAt ( ped thePed, float x, float y, float z [, int time = 3000 [, int blend = 1000 ], element target = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the ped to change the lookat of.&lt;br /&gt;
*'''x:''' the x coordinate of the world position to look at.&lt;br /&gt;
*'''y:''' the y coordinate of the world position to look at.&lt;br /&gt;
*'''z:''' the z coordinate of the world position to look at.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''time:''' the time, in milliseconds, during which the ped will look at the target. Once this time has elapsed, he will look ahead again like before the function was applied. A time of 0 will immediately stop any lookat. A negative time will make the ped look at the target indefinitely.&lt;br /&gt;
*'''blend:''' the time, in milliseconds, during which the look will blend.&lt;br /&gt;
*'''target:''' if this argument is specified, the position arguments will be ignored and the ped's gaze will follow the specified element instead. Can be a player, a vehicle, another ped etc.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
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 use [[triggerLatentServerEvent]] and [[triggerLatentClientEvent]] functions.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenSize_X, screenSize_Y = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
function pedLookAt()&lt;br /&gt;
   local x, y, z = getWorldFromScreenPosition(screenSize_X / 2, screenSize_Y / 2, 15)&lt;br /&gt;
   setPedLookAt(localPlayer, x, y, z, -1, 0)&lt;br /&gt;
end&lt;br /&gt;
setTimer(pedLookAt, 120, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|4325|setPedLookAt does not work for remote players}}&lt;br /&gt;
}}&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client ped functions}}&lt;/div&gt;</summary>
		<author><name>Vr.introv3nous</name></author>
	</entry>
</feed>