RU/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. ==Syntax== <syntaxhighlight lang="lua"> float float float getPedBonePosition ( ped thePed, int b...") |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
Функция возвращает координаты положения определённой части тела персонажа в формате 3D. | |||
== | ==Синтаксис== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float float float getPedBonePosition ( ped thePed, int bone ) | float float float getPedBonePosition ( ped thePed, int bone ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | ===Обязательные атрибуты=== | ||
*'''thePed:''' | *'''thePed:''' Персонаж, положение части тела которого требуется определить. | ||
*'''bone:''' | *'''bone:''' Часть тела, положение которой нужно определить. | ||
[[Image:Bones.jpg|thumb|Bone numbers]] | [[Image:Bones.jpg|thumb|Bone numbers]] | ||
<div style="border: 3px red solid; margin-bottom:3px; padding-left:5px;"> | <div style="border: 3px red solid; margin-bottom:3px; padding-left:5px;"> | ||
*'''1:''' BONE_PELVIS1 | *'''1:''' BONE_PELVIS1 '''- тазобедренная часть''' | ||
*'''2:''' BONE_PELVIS | *'''2:''' BONE_PELVIS '''- тазобедренная часть''' | ||
*'''3:''' BONE_SPINE1 | *'''3:''' BONE_SPINE1 | ||
*'''4:''' BONE_UPPERTORSO | *'''4:''' BONE_UPPERTORSO |
Revision as of 17:40, 8 February 2011
Функция возвращает координаты положения определённой части тела персонажа в формате 3D.
Синтаксис
float float float getPedBonePosition ( ped thePed, int bone )
Обязательные атрибуты
- thePed: Персонаж, положение части тела которого требуется определить.
- bone: Часть тела, положение которой нужно определить.
- 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
Returns
Returns the x, y, z world position of the bone.
Example
This example renders name tags above a player's head bone.
addEventHandler("onClientRender",getRootElement(), function() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix() for k, 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, getLocalPlayer()) 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 )
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle