Skip to content

Commit

Permalink
add more information and an example in lua AttachCamToPedBone
Browse files Browse the repository at this point in the history
  • Loading branch information
matehun00 authored Jul 21, 2023
1 parent 9a25e67 commit 83395c9
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions CAM/AttachCamToPedBone.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@ ns: CAM
void ATTACH_CAM_TO_PED_BONE(Cam cam, Ped ped, int boneIndex, float xOffset, float yOffset, float zOffset, BOOL isRelative);
```
This native works with peds only.
## Parameters
* **cam**:
* **ped**:
* **boneIndex**:
* **xOffset**:
* **yOffset**:
* **zOffset**:
* **isRelative**:
* **cam**: The camera handle.
* **ped**: The ped handle.
* **boneIndex**: This is different to boneID, use ['GET_PED_BONE_INDEX'](#_0x3F428D08BE5AAE31) to get the index from the ID. use the index for attaching to specific bones. ```cam``` will be attached to the center of ```ped``` if bone index given doesn't correspond to bone indexes for that entity type.
* **xOffset**: X-axis offset
* **yOffset**: Y-axis offset
* **zOffset**: Z-axis offset
* **isRelative**: Whether or not the camera will be relative to the bone
## Examples
```lua
local ped = PlayerPedId()
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
AttachCamToPedBone(cam,ped,4089, 0.0, 0.0, 0.0, true) -- attach it to a finger on the left hand
SetCamActive(cam, true)
RenderScriptCams(true, false, 0, true, true)
```

0 comments on commit 83395c9

Please sign in to comment.