<?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=ThanaReal</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=ThanaReal"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/ThanaReal"/>
	<updated>2026-04-29T12:54:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedBonePosition&amp;diff=71621</id>
		<title>GetPedBonePosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedBonePosition&amp;diff=71621"/>
		<updated>2021-08-09T15:47:59Z</updated>

		<summary type="html">&lt;p&gt;ThanaReal: &amp;quot;for _, v in ipairs( getElementsByType 'player' ) do&amp;quot; is changed as &amp;quot;for _, v in ipairs( getElementsByType ( 'player' ) ) do&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
Returns the 3D world coordinates of a specific bone of a given ped.&lt;br /&gt;
{{Tip|If you want attach element to ped bone, use [[https://community.multitheftauto.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=18389 pAttach]] resource}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getPedBonePosition ( ped thePed, int bone )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[ped]]:getBonePosition||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the ped you want to inspect.&lt;br /&gt;
*'''bone:''' the number of the bone to get the position of.&lt;br /&gt;
&lt;br /&gt;
[[Image:Bones.jpg|thumb|Bone numbers]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 3px red solid; margin-bottom:3px; padding-left:5px;&amp;quot;&amp;gt;&lt;br /&gt;
*'''1:''' BONE_PELVIS1&lt;br /&gt;
*'''2:''' BONE_PELVIS&lt;br /&gt;
*'''3:''' BONE_SPINE1&lt;br /&gt;
*'''4:''' BONE_UPPERTORSO&lt;br /&gt;
*'''5:''' BONE_NECK&lt;br /&gt;
*'''6:''' BONE_HEAD2&lt;br /&gt;
*'''7:''' BONE_HEAD1&lt;br /&gt;
*'''8:''' BONE_HEAD&lt;br /&gt;
*'''21:''' BONE_RIGHTUPPERTORSO&lt;br /&gt;
*'''22:''' BONE_RIGHTSHOULDER&lt;br /&gt;
*'''23:''' BONE_RIGHTELBOW&lt;br /&gt;
*'''24:''' BONE_RIGHTWRIST&lt;br /&gt;
*'''25:''' BONE_RIGHTHAND&lt;br /&gt;
*'''26:''' BONE_RIGHTTHUMB&lt;br /&gt;
*'''31:''' BONE_LEFTUPPERTORSO&lt;br /&gt;
*'''32:''' BONE_LEFTSHOULDER&lt;br /&gt;
*'''33:''' BONE_LEFTELBOW&lt;br /&gt;
*'''34:''' BONE_LEFTWRIST&lt;br /&gt;
*'''35:''' BONE_LEFTHAND&lt;br /&gt;
*'''36:''' BONE_LEFTTHUMB&lt;br /&gt;
*'''41:''' BONE_LEFTHIP&lt;br /&gt;
*'''42:''' BONE_LEFTKNEE&lt;br /&gt;
*'''43:''' BONE_LEFTANKLE&lt;br /&gt;
*'''44:''' BONE_LEFTFOOT&lt;br /&gt;
*'''51:''' BONE_RIGHTHIP&lt;br /&gt;
*'''52:''' BONE_RIGHTKNEE&lt;br /&gt;
*'''53:''' BONE_RIGHTANKLE&lt;br /&gt;
*'''54:''' BONE_RIGHTFOOT&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the x, y, z world position of the bone.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example renders name tags above a player's head bone.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientRender&amp;quot;,root,&lt;br /&gt;
   function( )&lt;br /&gt;
      local px, py, pz, tx, ty, tz, dist&lt;br /&gt;
      px, py, pz = getCameraMatrix( )&lt;br /&gt;
       for _, v in ipairs( getElementsByType ( 'player' ) ) do&lt;br /&gt;
         tx, ty, tz = getElementPosition( v )&lt;br /&gt;
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )&lt;br /&gt;
         if dist &amp;lt; 30.0 then&lt;br /&gt;
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then&lt;br /&gt;
               local sx, sy, sz = getPedBonePosition( v, 5 )&lt;br /&gt;
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 )&lt;br /&gt;
               if x then -- getScreenFromWorldPosition returns false if the point isn't on screen&lt;br /&gt;
                dxDrawText( getPlayerName( v ), x, y, x, y, tocolor(150, 50, 0), 0.85 + ( 15 - dist ) * 0.02, &amp;quot;bankgothic&amp;quot; )&lt;br /&gt;
               end&lt;br /&gt;
            end&lt;br /&gt;
         end&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example 2==&lt;br /&gt;
This one draw all local player's bones&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler('onClientRender', root, function()&lt;br /&gt;
	for bone = 1, 54 do&lt;br /&gt;
	 local bonePos = {getPedBonePosition(localPlayer, bone)}&lt;br /&gt;
		if bonePos[1] then&lt;br /&gt;
		 local screen = {getScreenFromWorldPosition(unpack(bonePos))}&lt;br /&gt;
			if screen[1] then&lt;br /&gt;
			 dxDrawText(''..bone, screen[1], screen[2])&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getPedBonePosition]]&lt;br /&gt;
[[ru:GetPedBonePosition]]&lt;/div&gt;</summary>
		<author><name>ThanaReal</name></author>
	</entry>
</feed>