SetMyFacingAngle: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Welcome| desc= Sets the facing angle of an NPC| params=<syntaxhighlight lang="lua">(angle)</syntaxhighlight> <poem>::angle : The new angle (in radians) for the NPC.</poem>|...") |
No edit summary |
||
Line 7: | Line 7: | ||
if(message=="lookatme") | if(message=="lookatme") | ||
{ | { | ||
local pos= | local pos=GetPlayerPos(playerid);local mypos=GetMyPos(); | ||
local angle=atan2(-(pos.x-mypos.x),pos.y-mypos.y) | local angle=atan2(-(pos.x-mypos.x),pos.y-mypos.y) | ||
SetMyFacingAngle(angle); | SetMyFacingAngle(angle); |
Latest revision as of 15:16, 18 March 2022
Description:
Sets the facing angle of an NPC
Parameters:
(angle)
angle : The new angle (in radians) for the NPC.
Return Values:
This function does not return any specific values.
Example
function OnPlayerText(playerid, message) { if(message=="lookatme") { local pos=GetPlayerPos(playerid);local mypos=GetMyPos(); local angle=atan2(-(pos.x-mypos.x),pos.y-mypos.y) SetMyFacingAngle(angle); } }
Related Functions
The following functions may be helpful as they relate to this function in one way or another.