HU/getPedBonePosition: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
 (Created page with "__NOTOC__ {{Client function}} Returns the 3D world coordinates of a specific bone of a given ped. {{Tip|If you want attach element to ped bone, use https://community.mtasa.c...")  | 
				|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__  | __NOTOC__  | ||
{{Client function}}  | {{Client function hu}}  | ||
Visszaadja az adott ped meghatározott csontjának 3D-s koordinátáit.  | |||
{{  | {{Tip_hu|Ha egy elemet szeretne a csonthoz kapcsolni, használja a [[https://community.mtasa.com/index.php?p=resources&s=details&id=2540 bone_attach]] resource-t}}  | ||
==  | ==Szintaxis==  | ||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
float, float, float getPedBonePosition ( ped thePed, int bone )  | float, float, float getPedBonePosition ( ped thePed, int bone )  | ||
| Line 10: | Line 10: | ||
{{OOP||[[ped]]:getBonePosition||}}  | {{OOP||[[ped]]:getBonePosition||}}  | ||
===  | ===Kötelező paraméterek===  | ||
*'''thePed:'''   | *'''thePed:''' a ped, akit szeretne vizsgálni.  | ||
*'''bone:'''   | *'''bone:''' a csontok száma, hogy megkapja a pozícióját.  | ||
[[Image:Bones.jpg|thumb|Bone numbers]]  | [[Image:Bones.jpg|thumb|Bone numbers]]  | ||
| Line 47: | Line 47: | ||
</div>  | </div>  | ||
===  | ===Visszatérési érték===  | ||
Visszaadja a csont x, y, z pozícióját.  | |||
==  | ==Példa==  | ||
Ez a példa kiírja a játékos nevét a feje fölött.  | |||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
addEventHandler( "onClientRender",root,  | addEventHandler( "onClientRender",root,  | ||
| Line 74: | Line 74: | ||
</syntaxhighlight>  | </syntaxhighlight>  | ||
==  | ==Példa 2==  | ||
Ez pedig kiírja az összes játékos csontját  | |||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
addEventHandler('onClientRender', root, function()  | addEventHandler('onClientRender', root, function()  | ||
| Line 90: | Line 90: | ||
</syntaxhighlight>  | </syntaxhighlight>  | ||
==  | ==Lásd még==  | ||
{{Client_ped_functions}}  | {{Client_ped_functions hu}}  | ||
[[en:getPedBonePosition]]  | [[en:getPedBonePosition]]  | ||
[[ru:GetPedBonePosition]]  | [[ru:GetPedBonePosition]]  | ||
==Fordította==  | |||
* '''''[https://wiki.multitheftauto.com/wiki/User:Surge Surge]'''''  | |||
Latest revision as of 17:09, 8 October 2018
Visszaadja az adott ped meghatározott csontjának 3D-s koordinátáit.
| Tipp: Ha egy elemet szeretne a csonthoz kapcsolni, használja a [bone_attach] resource-t | 
Szintaxis
float, float, float getPedBonePosition ( ped thePed, int bone )
OOP Syntax Help! I don't understand this!
- Method: ped:getBonePosition(...)
 
Kötelező paraméterek
- thePed: a ped, akit szeretne vizsgálni.
 - bone: a csontok száma, hogy megkapja a pozícióját.
 
- 1: BONE_PELVIS1
 - 2: BONE_PELVIS
 - 3: BONE_SPINE1
 - 4: BONE_UPPERTORSO
 - 5: BONE_NECK
 - 6: BONE_HEAD2
 - 7: BONE_HEAD1
 - 8: BONE_HEAD
 - 21: BONE_RIGHTUPPERTORSO
 - 22: BONE_RIGHTSHOULDER
 - 23: BONE_RIGHTELBOW
 - 24: BONE_RIGHTWRIST
 - 25: BONE_RIGHTHAND
 - 26: BONE_RIGHTTHUMB
 - 31: BONE_LEFTUPPERTORSO
 - 32: BONE_LEFTSHOULDER
 - 33: BONE_LEFTELBOW
 - 34: BONE_LEFTWRIST
 - 35: BONE_LEFTHAND
 - 36: BONE_LEFTTHUMB
 - 41: BONE_LEFTHIP
 - 42: BONE_LEFTKNEE
 - 43: BONE_LEFTANKLE
 - 44: BONE_LEFTFOOT
 - 51: BONE_RIGHTHIP
 - 52: BONE_RIGHTKNEE
 - 53: BONE_RIGHTANKLE
 - 54: BONE_RIGHTFOOT
 
Visszatérési érték
Visszaadja a csont x, y, z pozícióját.
Példa
Ez a példa kiírja a játékos nevét a feje fölött.
addEventHandler( "onClientRender",root,
   function( )
      local px, py, pz, tx, ty, tz, dist
      px, py, pz = getCameraMatrix( )
      for _, v in ipairs( getElementsByType 'player' ) do
         tx, ty, tz = getElementPosition( v )
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
         if dist < 30.0 then
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then
               local sx, sy, sz = getPedBonePosition( v, 5 )
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 )
               if x then -- getScreenFromWorldPosition returns false if the point isn't on screen
                dxDrawText( getPlayerName( v ), x, y, x, y, tocolor(150, 50, 0), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" )
               end
            end
         end
      end
   end
)
Példa 2
Ez pedig kiírja az összes játékos csontját
addEventHandler('onClientRender', root, function()
	for bone = 1, 54 do
	 local bonePos = {getPedBonePosition(localPlayer, bone)}
		if bonePos[1] then
		 local screen = {getScreenFromWorldPosition(unpack(bonePos))}
			if screen[1] then
			 dxDrawText(''..bone, screen[1], screen[2])
			end
		end
	end
end)
Lásd még
- HU/addPedClothes
 - HU/canPedBeKnockedOffBike
 - HU/createPed
 - HU/getPedAmmoInClip
 - HU/getPedAnalogControlState
 - HU/getPedAnimation
 - HU/getPedArmor
 - HU/getPedBonePosition
 - HU/getPedCameraRotation
 - HU/getPedClothes
 - HU/getPedContactElement
 - HU/getPedControlState
 - HU/getPedMoveState
 - HU/getPedOccupiedVehicle
 - HU/getPedOccupiedVehicleSeat
 - HU/getPedOxygenLevel
 - HU/getPedSimplestTask
 - HU/getPedStat
 - HU/getPedTarget
 - HU/getPedTargetCollision
 - HU/getPedTargetEnd
 - HU/getPedTargetStart
 - HU/getPedTask
 - HU/getPedTotalAmmo
 - HU/getPedVoice
 - HU/getPedWalkingStyle
 - HU/getPedWeapon
 - HU/getPedWeaponMuzzlePosition
 - HU/getPedWeaponSlot
 - HU/getValidPedModels
 - HU/givePedWeapon
 - HU/isPedChoking
 - HU/isPedDead
 - HU/isPedDoingGangDriveby
 - HU/isPedDoingTask
 - HU/isPedDucked
 - HU/isPedHeadless
 - HU/isPedInVehicle
 - HU/isPedOnFire
 - HU/isPedOnGround
 
- HU/isPedWearingJetpack
 - HU/killPed
 - HU/removePedClothes
 - HU/removePedFromVehicle
 - HU/setAnalogControlState
 - HU/setPedAimTarget
 - HU/setPedAnalogControlState
 - HU/setPedAnimation
 - HU/setPedAnimationProgress
 - HU/setPedCameraRotation
 - HU/setPedCanBeKnockedOffBike
 - HU/setPedControlState
 - HU/setPedDoingGangDriveby
 - HU/setPedFootBloodEnabled
 - HU/setPedHeadless
 - HU/setPedLookAt
 - HU/setPedOnFire
 - HU/setPedOxygenLevel
 - HU/setPedStat
 - HU/setPedTargetingMarkerEnabled
 - HU/setPedVoice
 - HU/setPedWalkingStyle
 - HU/setPedWeaponSlot
 - HU/warpPedIntoVehicle