Garry's Mod Wiki

Revision Difference

Player:SetEyeAngles#527154

<function name="SetEyeAngles" parent="Player" type="classfunc"> <description>Sets the angle of the player's view (may rotate body too if angular difference is large)</description> <realm>Shared</realm> <args> <arg name="angle" type="Angle">Angle to set the view to</arg> </args> </function> <example> <description>Points a player at Vector(0,0,0)</description> <description>Points a player at Vector( 0, 0, 0 )</description> <code> local ply = LocalPlayer() // Or any player local vec1 = Vector(0,0,0) -- Where we're looking at local vec1 = Vector( 0, 0, 0 ) -- Where we're looking at local vec2 = ply:GetShootPos() -- The player's eye pos ply:SetEyeAngles((vec1 - vec2):Angle()) -- Sets to the angle between the two vectors ply:SetEyeAngles( ( vec1 - vec2 ):Angle() ) -- Sets to the angle between the two vectors </code> <output>Local player will look at 0,0,0</output> </example>