[HELP] AttachEntityToEntity explenation

Hi all, I’ve recently found the ‘AttachEntityToEntity’ function and have added it to my script, but am unable to find any documentation on what each value is and I need to rotate the Entity that is being attached, Below is the code I’m currently Using, could someone point out what is what, I know the first is the prop, 2nd is the player to attach to, 3rd is obv the bone index, 4/5/6 i assume is vector3 (xyz?) position, 7/8/9 I assume would be rotation (however all it did when I modified these numbers was the object flipped 180° and stayed there and woulded rotate any other direction), and from 10 onwards I wouldnt have a clue what these bools and Int are even for… could someone please enlighten me… Thank you! :slight_smile:

    local x,y,z = table.unpack(GetEntityCoords(playerPed))
    local prop = CreateObject(GetHashKey(Config.DrinkName), x, y, z + 0.2, true, true, true)
    local boneIndex = GetPedBoneIndex(playerPed, 28422)
                        --1        2         3        4     5      6      7     8     9    10    11     12    13   14  15
    AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.001, 10.0, 175.0, 0.0, true, true, false, true, 1, true)
2 Likes

void ATTACH_ENTITY_TO_ENTITY(Entity entity1, Entity entity2, int boneIndex, float xPos, float yPos, float zPos, float xRot, float yRot, float zRot, BOOL p9, BOOL useSoftPinning, BOOL collision, BOOL isPed, int vertexIndex, BOOL fixedRot);

Awesome Thanks Ill have to bookmark that website as it seems to be hidden from all google searches.

1 Like

Hello, possible to attach a PED to our player ?